luni, 3 septembrie 2012

dadawda

Jquery makes it very easy to manipulate the the DOM, this makes it so easy to change any element on your webpage.

One of those elements is the reference to your stylesheet, so using jQuery you can easily switch between different stylesheets.

But why would you want to switch between different stylesheets?

There are many different reasons to switch between stylesheet one of the most common is for accessibility. Many websites allow users to pick the font size displayed on the page but what if changing the font size will push your layout out and your website won't look the same any more. You can assign adifferent stylesheet for different font sizes so you can make sure that your website will always look good and it doesn't matter what the font size is.

What if you have a website which has a lot of colour and your visitors will prefer to have a normal black and white page then you can have a stylesheet just for black and white pages.

You can even have some fun with stylesheets and completely change the look of the website using the same DOM elements and allow your visitors to pick the layout they use.

You can do so many things with just changing the stylesheet, so in this article I am going to show you a quick and easy way you can change the style sheet by using jQuery.

In the demo page you are able to switch between 4 different stylesheets just by clicking on a button for the demo the stylesheet will just be changing the background colour of the page. You can also download the demo page to give it a go yourself.