2016-11-26 5 views
0

Я использую jquery.touchSwipe плагин, но есть одна проблема, с которой я сейчас сталкиваюсь.jquery.touchSwipe проблема со ссылкой

Если есть какая-либо ссылка внутри div, она не будет работать, когда вы попытаетесь открыть эту ссылку, но когда вы проведете ее, она будет работать нормально.

проверьте приведенный ниже код.

$(function() { \t \t \t 
 
\t \t \t \t \t //Enable swiping... 
 
\t \t \t \t \t $("#test").swipe({ 
 
\t \t \t \t \t \t //Generic swipe handler for all directions 
 
\t \t \t \t \t \t swipe:function(event, direction, distance, duration, fingerCount, fingerData) { 
 
\t \t \t \t \t \t \t $(this).html("You swiped " + direction+"<br><a href='http://www.google.com/'>google.com</a>"); \t 
 
\t \t \t \t \t \t }, 
 
\t \t \t \t \t \t //Default is 75px, set to 0 for demo so any distance triggers swipe 
 
\t \t \t \t \t threshold:0 
 
\t \t \t \t \t }); 
 
\t \t \t \t });
.box 
 
{ 
 
\t margin-top:20px; 
 
\t margin-bottom:20px; 
 
\t max-width:768px; 
 
\t height:300px; 
 
\t 
 
\t padding: 10px; 
 
\t background-color: #EEE; 
 
\t -webkit-border-radius: 6px; 
 
\t -moz-border-radius: 6px; 
 
\t border-radius: 6px; 
 
\t 
 
\t text-align:center; 
 
\t font-weight: 300; 
 
\t font-size: 20px; 
 
\t line-height: 36px; 
 
\t 
 
\t overflow:hidden; 
 
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> 
 
<script src="http://m.couponi.com.sa/jquery.touchSwipe.js"></script> 
 

 
<div id="test" class="box">Swipe me 
 
      
 
      
 
      <a href="http://www.google.com/">google.com</a> 
 
      
 
      
 
      
 
      </div>

ответ

0

я получить решение для моего вопроса.

, чтобы иметь возможность щелкнуть/нажимать ссылки, но также иметь возможность прокручивать меню, вам необходимо использовать салфетку, возможно, 75 (не ноль!) И убедитесь, что исключен элемент «A», или вы может оставить список исключений.

$(function() {   
       //Enable swiping... 
       $("#test").swipe({ 
        //Generic swipe handler for all directions 
        swipe:function(event, direction, distance, duration, fingerCount, fingerData) { 
         $(this).html("You swiped " + direction+"<br><a href='http://www.google.com/'>google.com</a>"); 
        }, 
        //Default is 75px, set to 0 for demo so any distance triggers swipe 
    threshold: 75, 
    excludedElements: "" 
       }); 
      }); 
Смежные вопросы