javascript - Disable link on first click and act as a:hover -


i want disable link contains dropdown menu when user access website via tablet devices, so, when users taps link tablet:

-> dropdown appears link disabled, on second tap link works.

i think solved haven't found nothing suitable yet, i'm working code here

jquery(document).ready(function ($) {      $("li.taphover > a").on('touchstart', function (e) {         'use strict'; //satisfy code inspectors         var link = $(this); //preselect link         if (link.hasclass('hover')) {             return true;         } else {             link.addclass('hover');             $('li.taphover > a').not(this).removeclass('hover');             e.preventdefault();             return false; //extra, , make sure function has consistent return points         }     });  }); 

but disables link, , nothing works.

i found simple jquery plugin here works. link has tutorial how create responsive menu disables top dropdown links (li:has(ul)) on first click.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -