Home >Web Front-end >JS Tutorial >jQuery implements responsive browser zoom size and changes background color_jquery

jQuery implements responsive browser zoom size and changes background color_jquery

WBOY
WBOYOriginal
2016-05-16 16:32:311374browse
/*Javascript代码片段*/

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