I have a DIV #overlay sitting over DIV #page, but on the #page div, theres a overscroll: auto on an element.
How can I disable all touch events on #page when #overlay is visible and then enable back once #overlay is hidden?
<div id="page">touchable content here</div>
<div id="overlay">sits on top of #page DIV</div>
This is for mobile webkit only.
I have a DIV #overlay sitting over DIV #page, but on the #page div, theres a overscroll: auto on an element.
How can I disable all touch events on #page when #overlay is visible and then enable back once #overlay is hidden?
<div id="page">touchable content here</div>
<div id="overlay">sits on top of #page DIV</div>
This is for mobile webkit only.
Share Improve this question edited Jan 19, 2012 at 5:11 calebo asked Jan 19, 2012 at 5:00 calebocalebo 3,44210 gold badges48 silver badges69 bronze badges1 Answer
Reset to default 3CSS Solution div#page { pointer-events: none; }
jQuery Solution
your touch event -
$('#page').click(function () {
if($(this).hasClass('blockEvent')) return false;
//do something...
});
when #overlay pops up -
// display #overlay
$('#page').addClass('blockEvent');
when #overlay closed -
// close #overlay
$('#page').removeClass('blockEvent');
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745459618a4628645.html
评论列表(0条)