Skip to content

Commit 5896d13

Browse files
author
Spandana Chittimala
committed
Merge remote-tracking branch 'tango/MC-16233' into PR-05-29-2019
2 parents 5831fe7 + 9076515 commit 5896d13

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

app/code/Magento/Review/view/frontend/web/js/process-reviews.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,23 @@ define([
5050

5151
$(function () {
5252
$('.product-info-main .reviews-actions a').click(function (event) {
53-
var anchor;
53+
var anchor, addReviewBlock;
5454

5555
event.preventDefault();
5656
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+
6570
});
6671
});
6772
};

0 commit comments

Comments
 (0)