Home  >  Article  >  Web Front-end  >  jquery method to implement different size browsers to use different css style sheets_jquery

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

WBOY
WBOYOriginal
2016-05-16 16:53:541477browse

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! !
Statement:
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