Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.65 KB | None | 0 0
  1.     <script>
  2.         function is_touch_device() {
  3.             return !!('ontouchstart' in window);
  4.         }
  5.  
  6.  
  7.         jQuery(document).ready(function() {
  8.             if (is_touch_device()) {
  9.                 jQuery('.level-top > a').each(function(index, elem) {
  10. var link_value = jQuery(this).attr("href");
  11.  
  12.                     jQuery(this).on('click', function(e) {
  13. alert(jQuery("a").attr("data-click"));
  14.  
  15.                         if (jQuery("a").attr("data-click") == undefined) {
  16.                             jQuery("a").attr("data-click", 1);
  17.                             jQuery(this).attr('href', '#');
  18.                         }
  19.                         else if (jQuery("a").attr("data-click") == 1) {
  20.                             jQuery(this).attr('href', link_value);
  21.                         }
  22.  
  23.                     });
  24.                 });
  25.  
  26.             }
  27.         });  
  28.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement