Home > Web Front-end > JS Tutorial > body text

jquery method to implement different size browsers to use different css style sheets_jquery

WBOY
Release: 2016-05-16 16:53:54
Original
1513 people have browsed it

This method supports IE and other browsers.

1. First define two links, of course you can also have one. The second one is the css to be changed

Copy code The code is as follows:



2. The following JavaScript code will change the css
Copy code The code is as follows:
function adjustStyle(width) {
width = parseInt(width);
if (width < 701) {
$("#css").attr("href", "css/narrow.css");
} else if ((width >= 701) && ( width < 900)) {
                                                                                                             : 🎜>$(function() {
adjustStyle($(this).width());
$(window).resize(function() {
adjustStyle($(this).width() );
});
});

The above code has been tested and available! !
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