code clip

Code Clip

根据屏幕大小更改样式

jQuery

1
2
3
4
5
if (window.screen.width < 1920||$(window).width()<1920) {
$(document.body).css({
"overflow-y": "auto"
});
};

根据屏幕大小以及浏览器更改样式

html

1
2
3
4
5
6
7
8
9
10
<!--[if IE 8]>
<script>
$(document).ready(function () {
window.onresize = function () { location = location };
if ($(window).width() < 1400) {
$(".spanFont").css("font-size", "16px");
} else {}
})
</script>
<![endif]-->

回车登录

html

1
<body onkeydown="keyLogin(et)">

jQuery

1
2
3
4
function keyLogin(et){
if (et.keyCode==13||et.which==13)
document.getElementById("login-btn").click();
}

禁止右键

jQuery

1
2
3
4
5
$(document).ready(function(){
$(document).bind("contextmenu",function(e){
return false;
});
});

页面样式切换

jQuery

1
2
3
4
5
$(document).ready(function() {
$("a.Styleswitcher").click(function() {
$('link[rel=stylesheet]').attr('href' , $(this).attr('rel'));
});
});

html

1
2
3
4
5
6
<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 !
欣赏此文?求鼓励,求支持!