Fix page scroll issues at order history and order view page

This commit is contained in:
Abhishek Kumar
2022-09-22 17:11:35 +05:30
parent 52fdbd8501
commit e57e9cf923
3 changed files with 10 additions and 5 deletions

View File

@@ -86,9 +86,8 @@ function error_modal(heading, msg) {
}
//move to hash after clicking on anchored links
function scroll_if_anchor(href) {
function scroll_if_anchor(href, fromTop = 120) {
href = typeof(href) === "string" ? href : $(this).attr("href");
var fromTop = 120;
if(href.indexOf("#") === 0) {
var $target = $(href);
if($target.length) {

View File

@@ -326,16 +326,17 @@ function init()
$('.edit_product_fields, .standard_refund_fields, .partial_refund_fields, .order_action').hide();
$('tr#new_product').slideDown('fast', function () {
$('tr#new_product td').fadeIn('fast', function() {
$('tr#new_product td').fadeIn('fast').promise().done(function () {
$('#add_product_product_name').focus();
scroll_if_anchor('#new_product');
scroll_if_anchor('#new_product', 360);
});
});
e.preventDefault();
});
$('#cancelAddProduct').unbind('click').click(function() {
$('.order_action').show();
$('.order_action').not('.standard_refund_fields').show();
$('tr#new_product td').fadeOut('fast');
});

View File

@@ -156,6 +156,11 @@ function sendOrderMessage()
}
$(document).ready(function(){
var page = $('html, body');
page.on('mousewheel', function () {
page.stop();
});
// If customer clicks for refund request then toggle refund request fields
$('body').on('click', '#order_refund_request', function(e) {
e.preventDefault();