Friday, May 24, 2013

jQuery add attribute or make a link react on double click

Hi, so today I got this code as an example to create an added attribute.

jQuery(document).ready(function() { jQuery(".menu-item a").attr("href", "something"); } );

Check out this for double tap overwrite in iPad:
http://appcropolis.com/implementing-doubletap-on-iphones-and-ipads/

Function to react on double click example


jQuery(function($) {
    $('#clickme').click(function() {
        return false;
    }).dblclick(function() {
        window.location = this.href;
        return false;
    });
}); 

$('.menu-item a').doubletap( /** doubletap-dblclick callback */ function(event){ alert('double-tap'); window.location = this.href; }, /** touch-click callback (touch) */ function(event){ alert('single-tap'); window.location = "#"; }, /** doubletap-dblclick delay (default is 500 ms) */ 500 ); $('.sub-menu a').doubletap(function(event) { window.location = this.href; })

No comments:

Post a Comment