<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DIV CSS遮罩层</title&…
实现思路: 1.需要有一个层将body遮住,放在body上方. 2.修改body的overflow属性值为:hidden 废话不多说了,将关键代码贴出来了,兼容火狐,谷歌,ie 遮罩层的样式代码,红色部分是关键的部分 复制代码代码如下: .cover {position:fixed; top: 0px; right:0px; bottom:0px;filter: alpha(opacity=60); z-index: 1002; left: 0px; display:none;opacity:0…
实现效果: 1.loading指令: "use strict" /** * Created by yw on 2015/9/27. * user defined loading directive */ angular.module('bet.loading', []) .directive('loading', loading); function loading() { return { restrict: 'E', transclude: true, template: '<…
在页面上显示一个遮罩层,这是非常常见的操作,在遮罩层上操作,下层也会默认跟随手指滚动 此处就是要在显示遮罩的时候禁止下层滚动. 首先设置一个全局变量 var canScroll=false; 页面初始化的时候添加事件监听 document.addEventListener('touchmove',function(e){             if(!canScroll){                 e.preventDefault()             }         })…
刚才在写一个界面,其中为了考虑背景图片的缘故,所以没用Button而是用的a标签 在点击之后应该禁用掉a元素,禁用对于button比较容易,加一个disabled就可以了 但是对于a却没有太好的办法,总不能把href="",更何况我是走的onclick函数 所以百度了一下,然后看到有用遮罩实现的,源代码有bug,然后按照它的思路自己重写了一下 --------- 下面粘一下代码吧,这个遮罩层实现法其实就是在当前元素外wrap一个层,层内增加一个z-index比较大的透明层,直接罩住原来…
/*遮罩层代码 作用:通过遮罩层的方式防止表单提交次数过多 */ function MaskIt(obj){ var hoverdiv = '<div class="divMask" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; background: #fff; opacity: 0; filter: alpha(opacity=0);z-index:5;"…
不要使用absolute定位,用fixed就行.然后 background:rgba(0, 0, 0, 0.5); position:fixed; z-index: 100; left:0; right:0; top:0; bottom:0;…
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script> <title></title> </head> <body> <button…
想做成车修好了和没修好的对比,所以需要两个图片.需要用到的知识点, 1.定位 2.mouse 的事件(代码中体现) 3.鼠标指针的移动距离算法 4.css中,cursor的应用 好了,废话不多说 ,直接上代码 网站需要的素材,接着往下看下载 <!doctype html> <html> <head> <meta charset="utf-8"> <title>无标题文档</title> <style>…
// create div var mask=document.createElement("div"); mask.id="mask"; mask.style.position="absolute"; mask.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=4,opacity=25)";//IE的不透明设置 mask.style.opacity=0.4…