jquery.cookie不工作?

时间:2011-03-16 20:37:14

标签: jquery cookies

我有一个flash组件我想只在访问者访问网站时显示一次,我觉得代码是正确的,但似乎没有正常工作?每次都会显示flash对象。

    <style media="screen" type="text/css">  

#brotherhoodCta{
            position:fixed;
            bottom:0;
            left:0;
            width:100%;
            height:248px; 
            overflow:hidden;
            z-index:10000000000;
        }

        #brotherhoodCta img{
            border:none;
        }

            #wrapper, 
            #persistent-bar, #persistent-bar:hover {
                display:none;
                position:fixed;
                bottom:0;
                left:0;
                width:100%;
                height:250px;
                overflow:hidden;
                }

            #persistent-bar {
                text-align: center; 
                width:100%;
                }
        </style>



<script type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function() {
    var COOKIE_NAME = 'nyr_brotherhood';
    var options = { path: '/', expiration: 1 };

        if (jQuery.cookie(COOKIE_NAME) == null)
        {
            showCta();
            jQuery.cookie(COOKIE_NAME, "viewed", options);
        }       


    function showCta()
    {
        jQuery('#persistent-bar').show();
    }
    });
    </script>

<div id="brotherhoodCta">
<div id="persistent-bar">
<script type="text/javascript" charset="utf-8">
                // SWFObject Setup

                // flash vars
                var flashvars = {};

                // params
                var params = {};
                params.menu = "false"
                params.wmode = "transparent";

                //attributes
                var attributes = {id: "PlayoffCTA"};

                // embed it
                swfobject.embedSWF("http://rangers.nhl.com/v2/ext/playoffs-2011/RangersPlayoffCTA.swf", "persistent-bar", "100%", "250", "10.0.0", false, flashvars, params, attributes);
            </script></div>

1 个答案:

答案 0 :(得分:1)

将CSS更改为:

#persistent-bar {
text-align: center; 
width:100%;
display: none;
}