Merge pull request #22784 from woocommerce/fix/21959

Trigger zoom if moving cursor over image quickly in product gallery
This commit is contained in:
Mike Jolley 2019-02-28 12:09:05 +00:00 committed by GitHub
commit 4e485b75c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 5 deletions

View File

@ -44,7 +44,19 @@ jQuery( function( $ ) {
} ) } )
// Star ratings for comments // Star ratings for comments
.on( 'init', '#rating', function() { .on( 'init', '#rating', function() {
$( '#rating' ).hide().before( '<p class="stars"><span><a class="star-1" href="#">1</a><a class="star-2" href="#">2</a><a class="star-3" href="#">3</a><a class="star-4" href="#">4</a><a class="star-5" href="#">5</a></span></p>' ); $( '#rating' )
.hide()
.before(
'<p class="stars">\
<span>\
<a class="star-1" href="#">1</a>\
<a class="star-2" href="#">2</a>\
<a class="star-3" href="#">3</a>\
<a class="star-4" href="#">4</a>\
<a class="star-5" href="#">5</a>\
</span>\
</p>'
);
} ) } )
.on( 'click', '#respond p.stars a', function() { .on( 'click', '#respond p.stars a', function() {
var $star = $( this ), var $star = $( this ),
@ -210,6 +222,12 @@ jQuery( function( $ ) {
zoomTarget.trigger( 'zoom.destroy' ); zoomTarget.trigger( 'zoom.destroy' );
zoomTarget.zoom( zoom_options ); zoomTarget.zoom( zoom_options );
setTimeout( function() {
if ( zoomTarget.find(':hover').length ) {
zoomTarget.trigger( 'mouseover' );
}
}, 100 );
} }
}; };