且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在显示/隐藏元素(jQuery)中使用jquery cookie

更新时间:2022-11-10 19:04:54

我认为以下是你要找的。让我知道,如果我错了。祝你好运!



http://jsfiddle.net / 8VCJY / 8 /



- EDIT -



!我的cookie被倒退了。它现在工作(新链接)。



实际上,我没有'甚至知道它是否工作。它看起来像它,但后来审查我的代码,我不能看到这可能是正确的。总而言之,我很确定cookie在适当的时间的设置,什么都不会使你在正确的路径。我认为我的插件的使用是错误的,老实说(我从来没有使用过它),但我给了它,我可以。我希望它至少对你有用。


How to use jquery cookies in showing/hiding elements in a page ? I got the plugin from here

Tried some method but i am not successful. I used slideUp() and slideDown() functions to show/hide elements.

When a element is slided up a cookie should be set. when the page is refreshed, the element should be in slided up position

How to apply cookie when slided up and how to get the cookie when page is refreshed ? I need help !

I think the following is what you're looking for. Let me know if I am mistaken. Good luck!

http://jsfiddle.net/8VCJY/8/

- EDIT -

Sorry! My cookies were getting set backwards. It does work now (new link). Again, all apologies.

- EDIT -

Actually, I don't even know if it does work. It looked like it did, but then reviewing my code, I can't see how that could be right. All in all, I'm pretty sure that the setting of the cookie at the appropriate time and whatnot will at least get you on the right path. I think my usage of the plugin is wrong, to be honest (I've never used it before), but I gave it what I could. I hope it was at least somewhat useful to you.