【发布时间】:2011-12-11 09:43:07
【问题描述】:
我的网页中有这个基于 jQuery 的 CSS 样式切换器。当我将浏览器更新到 Safari 5.1 时,此脚本停止工作。我环顾四周,看到this 苹果讨论页面,原因是 Safari 5.1 中禁用了备用样式表。谁能帮我解决这个问题?我不是程序员,所以我无法弄清楚。
作者页面http://www.kelvinluck.com/assets/jquery/styleswitch/toggle.html
(function($)
{
$(document).ready(function() {
$('.styleswitch').click(function()
{
switchStylestyle(this.getAttribute("rel"));
return false;
});
var c = readCookie('style');
if (c) switchStylestyle(c);
});
function switchStylestyle(styleName)
{
$('link[rel*=style][title]').each(function(i)
{
this.disabled = true;
if (this.getAttribute('title') == styleName) this.disabled = false;
});
createCookie('style', styleName, 365);
}
})(jQuery);
【问题讨论】:
标签: javascript jquery css safari