jquery.cookie not working?
I have a flash component I would like to be shown only once when a visitor comes to the site, I feel like the code is correct but it does not seem to be working properly? The flash object shows up every time.
<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>
Change your CSS to:
#persistent-bar {
text-align: center;
width:100%;
display: none;
}
精彩评论