【发布时间】:2010-04-27 01:00:21
【问题描述】:
我正在尝试使用下面的 jquery 脚本将一些 css 信息保存到 cookie 中。
对于 Firefox 来说一切都很好,但是 IE 在 jquery Line 4618 上抛出一个错误,每当我包含这个文件时
jQuery(document).ready(function() {
// cookie period
var days = 365;
// load positions and z-index from cookies
$("div[id*='tqitem']").each( function( index ){
$(this).css( "left",
$.cookie( "im_" + $(this).attr("id") + "_left") );
$(this).css( "top",
$.cookie( "im_" + this.id + "_top") );
$(this).css( "zIndex",
$.cookie( "tqz_" + this.id + "_zIndex") );
});
// bind event
$(".pagenumbers").draggable({cursor: "move"});
$("div[id*='tqitem']").bind('dragstop', savePos);
$("div[id*='tqitem']").bind('dragstop', savePot);
// save positions into cookies
function savePos( event, ui ){
$.cookie("im_" + $(this).attr("id") + "_left",
$(this).css("left"), { path: '/', expires: days });
$.cookie("im_" + this.id + "_top",
$(this).css("top"), { path: '/', expires: days });
$.cookie("im_" + this.id + "_zIndex",
$(this).css("zIndex"), { path: '/', expires: days });
};
var thiss = $("div[id*='tqitem']");
function savePot(){
$("div[id*='tqitem']").each(function (i) {
$.cookie("tqz_" + $(this).attr("id") + "_zIndex",
$(this).css("zIndex"), { path: '/', expires: days });
})
};
});
/*ADDITIONAL INFO:
SCRIPT HIERARCHY
Jquery itself
Jquery ui
Jquery cookie plugin
Save cookies js
no matter how i ordered them the result did not change*/
【问题讨论】:
标签: jquery css user-interface cookies