Posts

Showing posts from May, 2014

Touch Device Hover effect

$(document).ready(function() { /* If mobile browser, prevent click on parent nav item from redirecting to URL */ if(is_touch_device()) { //$('.menu > li > a').attr('href' ,'#'); $('.menu li > ul').each(function (index, domEle) { /* Method 1: Use this to modify the href on the <a> to # */ //$(domEle).prev('a').attr('href' ,'#'); /* Method 2: Use this to keep the href on the <a> intact but prevent the default action */ $(domEle).prev('a').click(function(event) { event.preventDefault(); }); }); } }); //check is this a mobile browser function is_touch_device() { return !!('ontouchstart' in window); } </script> 

Stop Drop down in select box click event

jQuery(document).ready(function($){ setTimeout(function () {         $('selector').find('selector').click(function (e) {             e.stopPropagation();         });     }, 1000);   });