Guest User

Untitled

a guest
Dec 10th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. $('#slider').on('touchstart', '.tp-caption > a', function(){
  2. self.location = $(this).attr('href');
  3. });
  4.  
  5. //Переменная, в которую записывается, было ли перемещение
  6. var scrl = false;
  7.  
  8. //Если было совершено событие touchmove, меняем значение переменной на true
  9. $('#slider').on('touchmove', '.tp-caption > a', function(){
  10. scrl = true;
  11. });
  12.  
  13. //Во время выполнения touchend проверяем было ли перемещение, если было - обнуляем
  14. //значение переменной, а если не было - переходим по ссылке
  15. $('#slider').on('touchend', '.tp-caption > a', function(){
  16. if (scrl != true){
  17. self.location = $(this).attr('href');
  18. }else{
  19. scrl = false;
  20. }
  21. });
Add Comment
Please, Sign In to add comment