我从下面的网站寻找效果。如果您单击页面上的任何位置,将显示全屏div /后台。链接链接等。还得按一下。
测试:http://bit.ly/VUOPKQ
我的网站是:http://www.ee12.dk/ (密码engbirk2012),如果你第一次点击它工作,但我不想一次又一次地显示该层。
<div class='clickOnMe' onmouseup='mouseUp(this);' onmousedown='mouseDown(this);'>
</div>
<style>
.clickOnMe {
margin-top: -50px;
min-height: 100%;
min-width: 100%;
position: fixed;
z-index: 9999999999999999999999999;
}
</style>
<script type='text/javascript'>
function mouseUp(element){
element.style.background = 'none';
element.style.pointerEvents = 'none';
}
function mouseDown(element){
element.style.backgroundImage="url('http://www.ee12.dk/wp-content/uploads/2014/08/blackani.gif')";
}
</script>
发布于 2014-08-30 10:34:46
我将单击事件绑定到页面主体,使用jquery将单击事件绑定到页面上的每个A标记,使用$(' body ').on(" click“、'a‘、function(){}),然后在单击绑定到A标记中设置变量(DoIt=false)。然后,在页面的click事件中,检查变量,然后根据该变量显示div。然后,一定要始终将其设置为真在身体的点击事件结束。
$('body').click(function(){ if (DoIt == true) {/* do something */} DoIt=true;});
$('body').on('click', 'a', function(){ DoIt == false ;});
我想你知道这个主意了。在这里从ipad上的内存中编码。:-)
发布于 2014-08-30 11:04:18
这是JSFIDDLE
下面是工作代码。这段代码使用的是div
标记,当您按下鼠标按钮时,它将显示为全屏,并在释放它时将其隐藏。你可以根据你的要求来调整它。
$(document).mousedown(function () {
$('.fullscreen').show();
}).mouseup(function () {
$('.fullscreen').hide();
});
https://stackoverflow.com/questions/25581374
复制相似问题