【问题标题】:Jqueryui and cookie statusJqueryui 和 cookie 状态
【发布时间】:2011-03-29 19:33:17
【问题描述】:

我有这些代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Toggle</title>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="http://www.lywomen.com/js/jquery-ui.min.js"></script>
<style type="text/css">
    .toggler { width: 500px; height: 200px; }
    #button { padding: .5em 1em; text-decoration: none; }
    #effect { width: 240px; height: 135px; padding: 0.4em; position: relative; }
    #effect h3 { margin: 0; padding: 0.4em; text-align: center; }
    </style>
</head>

<body>
    <script type="text/javascript">
jQuery.noConflict();
    jQuery(function() {
        //run the currently selected effect
        function runEffect(){
            //get effect type from
            var selectedEffect = 'slide';

            //most effect types need no options passed by default
            var options = {};
            //check if it's scale or size - they need options explicitly set
            if(selectedEffect == 'scale'){  options = {percent: 0}; }
            else if(selectedEffect == 'size'){ options = { to: {width: 200,height: 60} }; }

            //run the effect
            jQuery("#effect").toggle(selectedEffect,options,500);

        };

        //set effect from select menu value
        jQuery("#button").click(function() {
            jQuery(this).toggleClass("clickedbuttons")
            runEffect();
            return false;
        });

    });
    </script>

<div class="demo">

<div class="toggler">
    <div id="effect" class="ui-widget-content ui-corner-all">
        <h3 class="ui-widget-header ui-corner-all">Toggle</h3>
        <p>
            Etiam libero neque, luctus a, eleifend nec, semper at, lorem. Sed pede. Nulla lorem metus, adipiscing ut, luctus sed, hendrerit vitae, mi.
        </p>
    </div>
</div>

<a href="#" id="button" class="ui-state-default ui-corner-all">Run Effect</a>
</div><!-- End demo -->

</body>

</html>

它的幻灯片效果显示和隐藏我想要它像 vbulletin.com/forum

当你点击隐藏它仍然隐藏,直到你点击显示保存供你的用户选择

所以我发现这个链接真的很有帮助

http://www.devcomments.com/q465701/jquery-and-cookie-status

但它与我的效果幻灯片不同,您能否管理代码以保存 cookie,因为该代码也请我使用 vbulletin

你可以检查那个链接

www.lywomen.com/f

它是我的论坛,您可以看到左侧边栏,我想选择隐藏和显示它

请帮帮我

非常感谢

【问题讨论】:

  • jsfiddle.net/5scYJ 我创建这个小提琴是为了更好地观察它。那么,您是否想要一个选项让用户始终隐藏侧边栏(例如在个人资料页面或设置页面中)?因为,否则,您的代码似乎可以正常工作。

标签: javascript jquery jquery-ui cookies


【解决方案1】:

检查那个链接

http://www.devcomments.com/q465701/jquery-and-cookie-status

您可以找到代码与 vbulletin 一起使用,请您管理它以使用我的代码,我在 html 页面中放置的简单示例

谢谢

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-03-28
    • 2015-07-23
    • 2014-12-29
    • 1970-01-01
    • 2013-09-12
    • 2013-11-06
    • 1970-01-01
    • 2011-10-26
    相关资源
    最近更新 更多