我有一個閱讀更多/更少jquery插件,我正在使用。其中一個設置(startOpen:真)允許內容在默認情況下,當你打開網頁進行擴展:將js函數添加到URL
<script>
$('#blog-post-2').readmore({
maxHeight: 212,
startOpen: true
});
$('#blog-post-1').readmore({
maxHeight: 212
});
</script>
我想要做的就是把startOpen:真正的功能到這個頁面的URL,像這樣:mywebsite.com/mypage.html & startOpen:true
原因是我想控制哪些用戶看到它擴大與否。
我不完全確定我會如何去實現這一點。
有沒有人有這個答案?
ŧ ry使用location.hash,當startOpen == true時set location.hash =「#startOpen:true」 - > http://www.w3schools.com/jsref/prop_loc_hash.asp – lshettyl