【问题标题】:switch body background using jquery?使用jquery切换身体背景?
【发布时间】:2010-10-19 01:20:29
【问题描述】:

我想使用 jquery 制作正文背景切换器。你会有一些按钮,每个按钮都会根据你的选择改变身体 bg。我想让它保存一个 cookie 以便在您更改页面时检索用户的选择。

第一部分我使用 .addclass 或 .css 得到它 但我被困在了用户的选择部分。

(对不起我的英语)

【问题讨论】:

    标签: jquery cookies


    【解决方案1】:

    还可以查看用于 jQuery 的 Cookie plugin,它允许您执行以下操作:

    $.cookie('the_cookie', 'the_value'); // Create a session cookie ("the_cookie") and set its value to "the_value"
    $.cookie('chocolate_chip_cookie', 'the_value', { // create a cookie with all available options
        expires: 7, // expires in seven days
        path: '/', // accessible from the whole site...
        domain: 'jquery.com',
        secure: true // ...but only on a https connection
    });
    $.cookie('the_cookie', null); // delete the session cookie
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-10-04
      • 1970-01-01
      • 2010-09-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多