StyleSwichter

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-14 06:43:03

软件介绍

StyleSwichter is a little jQuery plugin to alternate CSS stylesheets in a web page. StyleSwichter set the appropiate style (previously saved in a cookie) when the web page load, using the "DOM ready" function of jQuery. After this, you can use the plugin (the same function) to establish another style, and the plugin set it and save the selection in a cookie.

The plugin is around 2 KB and packed only 600 bytes. Take a look, the usage of plugin is here:

    // DOM ready!
    $(function(){
      var options={
        linkTitle: 'styleswichter',
        cookieName: 'selected-style'
      };
      $.fn.StyleSwichter(options);
    });

The plugin find in the appropiate cookie, and, if a style is saved previously, change to this style automatically. After this, in some place on your web page, you can use the plugin as is:

$.fn.StyleSwichter({cssPath: 'path/style.css'});

As you can see, in this case we indicate the path to a CSS stylesheet. The plugin establish this style and save in a cookie, to be use in sucesive reload of the page. Note that we not use all the options here. Take a look to the available options, that you can use if need. This is the default options values:

  $.fn.StyleSwichter.defaults={
    cssPath: '',
    cookiePath: '',
    cookieDays: 30,
    cookieDomain: '',
    cookieSecure: false,
    linkTitle: 'styleswichter',
    cookieName: 'selected-style'
  };

To read and write the appropiate cookie this plugin use the Cookie jQuery plugin, and this is required in order to use StyleSwichter. The plugin as been tested in Firefox 2, Opera 9, IExplorer 7 and Safari 3. The example file also contain the documentation (in source code) and the link to download StyleSwichter.

In my weblog (in spanish language) I prepare a page to publish this plugin, visit the StyleSwichter page in my weblog. Licensed under the GNU GPL license, I hope this little plugin maybe is usefull for you. Any comments are welcome.

本文地址:https://codercto.com/soft/d/23335.html

硅谷之火

硅谷之火

保罗·弗赖伯格、迈克尔·斯韦因 / 张华伟 编译 / 中国华侨出版社 / 2014-11-1 / CNY 39.80

《硅谷之火:人与计算机的未来》以生动的故事,介绍了计算机爱好者以怎样的创新精神和不懈的努力,将计算机技术的力量包装在一个小巧玲珑的机壳里,实现了个人拥有计算机的梦想。同时以独特的视角讲述了苹果、微软、太阳微系统、网景、莲花以及甲骨文等公司的创业者们在实现个人计算机梦想的过程中创业的艰辛、守业的艰难、失败的痛苦,在激烈竞争的环境中奋斗的精神以及在技术上不断前进的历程。一起来看看 《硅谷之火》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具