Home > Web Front-end > JS Tutorial > jQuery's method of skinning a page_jquery

jQuery's method of skinning a page_jquery

WBOY
Release: 2016-05-16 15:57:16
Original
1662 people have browsed it

The example in this article describes how to skin the page with jQuery. Share it with everyone for your reference. The specific analysis is as follows:

Many students have done the effect of changing the skin of the page. Today when browsing the blog, I also found a piece of code using jQuery to change the skin. I posted it to share with you:

$(document).ready(function(){
  $('#styleSwitch .button').bind('click', function(){
    $('body').removeClass();
    //remove all the other classes
    $('#styleSwitch .button').removeClass('selected');
    $(this).addClass('selected');
    switch(this.id){
      case 'style1':
        $('body').addClass('style1');
        break;
      case 'style2':
        $('body').addClass('style2');
        break;
      case 'style3':
        $('body').addClass('style3');
        break;
    }
    return false;
  });
});
Copy after login

I hope this article will be helpful to everyone’s jQuery programming.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template