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

jQuery implements responsive browser zoom size and changes background color_jquery

WBOY
Release: 2016-05-16 16:32:31
Original
1366 people have browsed it
/*Javascript代码片段*/

//定义一个方法:这个方法控制浏览器页面背景色的切换变化
function myfunction(){
 $('body').toggleClass('bgcolor');
}
//添加监控页面窗口变化的方法
$(window).resize(myfunction);
//并且在页面加载时即调用
myfunction();
Copy after login
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