I have some code that fades in the 开发者_JAVA技巧container div of the home page of my site and a picture frame around it, but I don't want it to ever display that effect again, even on subsequent page reloads, or even when the home page link is clicked. How would I go about this? Here is the code I currently have:
<script type="text/javascript" src="jquerys.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("img.frame").hide(0,function(){
$("div.container").hide(0,function(){
$("img.frame").fadeIn(1000);
$("div.container").fadeIn(1000);
});
});
});
</script>
Thank you for the help!
You can achieve your goal by using cookies.
Just write a cookie with a boolean value which should point to the fact that some request isn't the first one.
Finally, just put an "if" and eval if some cookie is true/false.
Could you create a cookie on the first time loading, and check if that cookie is set? If its set then don't call that code.
精彩评论