diff --git a/views/image_r.html b/views/image_r.html
index 14ee3e9..5eb716f 100644
--- a/views/image_r.html
+++ b/views/image_r.html
@@ -321,20 +321,25 @@
adjust_button_positions();
});
- $( document ).on( 'touchstart', function(){
- lastTouchTime = new Date();
- if ( hasHoverClass )
- {
- $('body').removeClass('hasHover');
- hasHoverClass = false;
- }
+ $( function(){
+ $(document).on( 'mousemove', activate_hover )
+ .on( 'touchstart', deactivate_hover );
});
- $( document ).on( 'mousemove', function(){
- if ( hasHoverClass || new Date() - lastTouchTime < 500 ) return;
+ function activate_hover(){
$('body').addClass('hasHover');
hasHoverClass = true;
- });
+ $(document).off( 'mousemove', activate_hover );
+ // do not remove touchstart event handler - might be fired later on some devices
+ }
+
+ function deactivate_hover(){
+ $('body').removeClass('hasHover');
+ hasHoverClass = false;
+ $(document).off( 'touchstart', deactivate_hover );
+ $(document).off( 'mousemove', activate_hover );
+ activate_swipe_gesture();
+ }
$('button[data-href]').click( function(){
if ( $(this).data('load') ){
@@ -406,6 +411,13 @@
}
$( function() {
+ $.get( '{{vtLink:-met="ajax/order_dialog.html"}}', function( data ){
+ $('#add-to-cart').html( data );
+ });
+
+ });
+
+ function activate_swipe_gesture(){
$('.container').swipe( {
swipeLeft: function( event, distance, duration, fingerCount, fingerData ){
if ( $('body').hasClass('modal-open') || $('#btnNext').prop('disabled') ){
@@ -423,7 +435,7 @@
return false;
},
});
- });
+ }