在显示/隐藏元素(jQuery)中使用jquery cookie [英] Use jquery cookies in showing/hiding elements (jQuery)

查看:131
本文介绍了在显示/隐藏元素(jQuery)中使用jquery cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在页面中显示/隐藏元素时使用jquery Cookie?我从此处获得了插件



尝试了一些方法,但我不成功。我使用slideUp()和slideDown()函数来显示/隐藏元素。



当一个元素向上滑动时,应该设置一个cookie。当页面刷新时,元素应该向上滑动



如何在滑动时应用cookie,以及如何刷新页面时如何获取cookie?
我需要帮助!

解决方案

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



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.

这篇关于在显示/隐藏元素(jQuery)中使用jquery cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆