Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecific a div area not to do the function using js/ jquery
    text
    copied!<p>Now I have a webpage function that is trigger in the window everywhere exclude the restrictArea. I have make the restrictArea overlap the main content. How can I specific this area do not trigger the function? I tried <code>e.preventDefault();</code> but it seems that does not work. Thanks</p> <pre><code>$(document).swipe(function(){ ............... }; $('#flip').swiperight(function(e){ e.stopPropagation(); e.preventDefault(); }); </code></pre> <p>Update: all the revelant code:</p> <p><strong>css:</strong></p> <pre><code>* { -webkit-user-select: none; /* disable auto selection (select/selectall when long tap)*/ -webkit-touch-callout: none; /* disable magnifier*/ } #flip { position:absolute; background-color:red; z-index:10; height: 100%; width:60%; left:20%; } </code></pre> <p><strong>js:</strong></p> <pre><code> $(document).swipeleft(function(){ //check the case when popup and thumbnail slide bar is not exist if ($("#popup").length == '0' &amp;&amp; parseInt($('#all_pages').css('left')) != '0'){ if (checkOrientation (orientation)== 'landscape'){ var pageLand = $('#book').turn('view'); pageLand = pageLand[1]; if (pageLand + 1 &lt; countImage &amp;&amp; pageLand != '0') $('#book').turn('page', pageLand + 1); } else{ var pagePort = $('#book').turn('page'); if (pagePort + 1 &lt; countImage &amp;&amp; pagePort != '0') $('#book').turn('page', pagePort + 1); } } }); $(document).swiperight(function(){ //check the case when popup and thumbnail slide bar is not exist if ($("#popup").length == '0' &amp;&amp; parseInt($('#all_pages').css('left')) != '0'){ if (checkOrientation (orientation)== 'landscape'){ var pageLand = $('#book').turn('view'); pageLand = pageLand[0]; if (pageLand - 1 &gt; 0) $('#book').turn('page', pageLand - 1); } else{ var pagePort = $('#book').turn('page'); if (pagePort - 1 &gt; 0) $('#book').turn('page', pagePort - 1); } } }); $('#flip').swiperight(function(e){ alert ('test'); e.stopPropagation(); e.preventDefault(); }); $('#flip').swipeleft(function(e){ alert ('test'); e.stopPropagation(); e.preventDefault(); }); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload