File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
app/code/Magento/Review/view/frontend/web/js Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -50,18 +50,23 @@ define([
50
50
51
51
$ ( function ( ) {
52
52
$ ( '.product-info-main .reviews-actions a' ) . click ( function ( event ) {
53
- var anchor ;
53
+ var anchor , addReviewBlock ;
54
54
55
55
event . preventDefault ( ) ;
56
56
anchor = $ ( this ) . attr ( 'href' ) . replace ( / ^ .* ?( # | $ ) / , '' ) ;
57
- $ ( '.product.data.items [data-role="content"]' ) . each ( function ( index ) { //eslint-disable-line
58
- if ( this . id == 'reviews' ) { //eslint-disable-line eqeqeq
59
- $ ( '.product.data.items' ) . tabs ( 'activate' , index ) ;
60
- $ ( 'html, body' ) . animate ( {
61
- scrollTop : $ ( '#' + anchor ) . offset ( ) . top - 50
62
- } , 300 ) ;
63
- }
64
- } ) ;
57
+ addReviewBlock = $ ( '.block.review-add .block-content #' + anchor ) ;
58
+
59
+ if ( addReviewBlock . length ) {
60
+ $ ( '.product.data.items [data-role="content"]' ) . each ( function ( index ) { //eslint-disable-line
61
+ if ( this . id == 'reviews' ) { //eslint-disable-line eqeqeq
62
+ $ ( '.product.data.items' ) . tabs ( 'activate' , index ) ;
63
+ }
64
+ } ) ;
65
+ $ ( 'html, body' ) . animate ( {
66
+ scrollTop : addReviewBlock . offset ( ) . top - 50
67
+ } , 300 ) ;
68
+ }
69
+
65
70
} ) ;
66
71
} ) ;
67
72
} ;
You can’t perform that action at this time.
0 commit comments