code clip 发表于 2016-12-08 | | 阅读次数 Code Clip根据屏幕大小更改样式jQuery12345if (window.screen.width < 1920||$(window).width()<1920) { $(document.body).css({ "overflow-y": "auto" }); }; 根据屏幕大小以及浏览器更改样式html12345678910<!--[if IE 8]><script> $(document).ready(function () { window.onresize = function () { location = location }; if ($(window).width() < 1400) { $(".spanFont").css("font-size", "16px"); } else {} })</script><![endif]--> 回车登录html1<body onkeydown="keyLogin(et)"> jQuery 1234function keyLogin(et){ if (et.keyCode==13||et.which==13) document.getElementById("login-btn").click();} 禁止右键jQuery12345$(document).ready(function(){ $(document).bind("contextmenu",function(e){ return false; }); }); 页面样式切换jQuery12345$(document).ready(function() { $("a.Styleswitcher").click(function() { $('link[rel=stylesheet]').attr('href' , $(this).attr('rel')); }); }); html123456<head> <link rel=stylesheet type=text/css href="default.css"></head> <a class="Styleswitcher" href="#" rel="default.css">Default Theme</a> <a class="Styleswitcher" href="#" rel="red.css">Red Theme</a> <a class="Styleswitcher" href="#" rel="blue.css">Blue Theme</a> ---------------Enjoy it ? Donate me ! 欣赏此文?求鼓励,求支持! 赏 微信打赏 支付宝打赏