背景图自适应
js:
- $(".bg-img").CSS("width", document.body.clientWidth);
css:
- .bg_img {
- background - image: url(/img/bg.png);
- background - attachment: fixed;
- background - repeat: no - repeat;
- background - size: cover; - moz - background - size: cover; - webkit - background - size: cover;
- } //适应移动设备.bg-img{ position: absolute; left: 0px; top: 0px; z-index:-2;}
移动设备屏幕大小
- alert(document.body.clientWidth+" "+document.body.clientHeight );
移动设备,禁止滚动
- document.body.addEventListener('touchmove',
- function(event) {
- event.preventDefault();
- },
- false);
透明背景
- .bg - white {
- background - color: rgba(255, 255, 255, 0.50);
- padding: 25px;
- margin - top: 20px;
- }
JS 引用 JS
- <script type=text/javascript>
- if (typeof SWFObject == "undefined") {
- document.write('<scr' + 'ipt type="text/javascript" src="/scripts/XXX.js"></scr' + 'ipt>');
- }
- </script>
setTimeout
setTimeout 不能在 $(doc..).ready(function(){}); 中使用 。
想调用传参数方法,用 function(){ method(param);}
jq show()/hide()
该两方法会将 display:none
如果是 row 结构,show 回来时记得将 display:inline,否则会变形
jq each
如果将统一 class 或标签的属性修改记得用 each,否则会有些 class 或标签的属性修改不成功
来源: