0
$(document).ready(function(){
var ScreenSizeHis = $.cookie(ScreenSizeHis);
    $("#arrow").bind('click', function(){
        $('#naviclosed').fadeIn("fast");
        $(window).unbind('resize');
    });
    $('#naviclosed').bind('click', function () {
        $('#naviclosed').fadeOut("fast");
        if ((ScreenSizeHis = $.cookie('ScreenSizeHis')) != undefined) {
            $(window).bind('resize', ScreenSize);
        }
    });
});
$(window).resize(function() {
    ScreenSize();
});
$(document).ready(function() {
 windowwidth = $(window).width();
if (windowwidth < 1040) {
    $('#naviclosed').fadeIn("fast");
}
if (windowwidth >= 1040) {
      $('#naviclosed').fadeOut("fast");
}
});
function ScreenSize()  {
  windowsize = $(window).width();
    if (windowsize < 1040) {
      $('#naviclosed').fadeIn("fast");
    }
    if (windowsize >= 1040) {
    $('#naviclosed').fadeOut("fast"); 
    }
}

好的,在我放入 cookie 插件后,这些按钮甚至都不起作用。

4

1 回答 1

0

您可以通过向 提供更多参数来设置 cookie $.cookie。单个参数用于检索:

//name, value, additional -- expire cookie in 30 days
$.cookie('ScreenSizeHis', ScreenSizeHis, {expires: 30});
于 2013-01-10T02:50:05.813 回答