From 6e5d4548807f6f52e2df9e6e49a3da93a270c8ca Mon Sep 17 00:00:00 2001 From: Mat Marquis Date: Fri, 30 Dec 2011 15:58:56 -0500 Subject: [PATCH] Ensured the hover delay only applies to touch devices, logic that was mysteriously absent from my previous commit. --- js/jquery.mobile.buttonMarkup.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/js/jquery.mobile.buttonMarkup.js b/js/jquery.mobile.buttonMarkup.js index a70ec523..512d2f4d 100755 --- a/js/jquery.mobile.buttonMarkup.js +++ b/js/jquery.mobile.buttonMarkup.js @@ -141,9 +141,14 @@ var attachEvents = function() { if ( btn ) { $btn = $( btn ); theme = $btn.attr( "data-" + $.mobile.ns + "theme" ); - hov = setTimeout(function() { + + if( $.support.touch ) { + hov = setTimeout(function() { + $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-down-" + theme ); + }, hoverDelay ); + } else { $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-down-" + theme ); - }, hoverDelay ); + } } }, "vmousecancel vmouseup": function( event ) { @@ -159,18 +164,24 @@ var attachEvents = function() { "vmouseover focus": function( event ) { var btn = closestEnabledButton( event.target ), $btn, theme; - + if ( btn ) { $btn = $( btn ); theme = $btn.attr( "data-" + $.mobile.ns + "theme" ); - foc = setTimeout(function() { + + if( $.support.touch ) { + foc = setTimeout(function() { + $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-hover-" + theme ); + }, hoverDelay ); + } else { $btn.removeClass( "ui-btn-up-" + theme ).addClass( "ui-btn-hover-" + theme ); - }, hoverDelay ); + } } }, "vmouseout blur scrollstart": function( event ) { var btn = closestEnabledButton( event.target ), $btn, theme; + if ( btn ) { $btn = $( btn ); theme = $btn.attr( "data-" + $.mobile.ns + "theme" );