From 2f5e4af2bda921267b411c1c87b6b631c8838e7e Mon Sep 17 00:00:00 2001 From: woadud Akand Date: Tue, 2 Jul 2019 11:01:17 +0600 Subject: [PATCH] Some Error handle from directorist search section --- includes/libs/vafpress/views/option/set.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/includes/libs/vafpress/views/option/set.php b/includes/libs/vafpress/views/option/set.php index e3952a2b72..1531551180 100644 --- a/includes/libs/vafpress/views/option/set.php +++ b/includes/libs/vafpress/views/option/set.php @@ -184,8 +184,12 @@ $(`a[href=#${panel_id}]`).click(); // animation add var body = $("html, body"); - body.stop().animate({scrollTop: el_len[tg_index].closest('.vp-section').offsetTop}, 500, 'swing'); - + if(el_len[tg_index].closest('.vp-section')){ + body.stop().animate({scrollTop: el_len[tg_index].closest('.vp-section').offsetTop}, 500, 'swing'); + } else { + body.stop().animate({scrollTop: el_len[tg_index].offsetTop}, 500, 'swing'); + } + if(el_len[tg_index].closest('.vp-field')) { el_len[tg_index].closest('.vp-field').classList.add('vp_select'); } else if(el_len[tg_index].closest('.vp-section')) { @@ -211,13 +215,15 @@ } } else if(e.keyCode === 38){ count --; - if(count <= 0){ + if(count < 0){ count = $('.search_detail a').length -1; } } var elemaent = $('.search_detail a'); // search item list - elemaent[count].classList.add('vp_item_active'); // search item list add class for active + if(elemaent.length){ + elemaent[count].classList.add('vp_item_active'); // search item list add class for active + } // press enter key functional if(e.keyCode === 13) { e.preventDefault(); @@ -229,7 +235,11 @@ $(`a[href=#${id}]`).click(); // animation scroll top for enter key var body = $("html, body"); - body.stop().animate({scrollTop: filter3[count].closest('.vp-section').offsetTop}, 500, 'swing'); + if(filter3[count].closest('.vp-section')){ + body.stop().animate({scrollTop: filter3[count].closest('.vp-section').offsetTop}, 500, 'swing'); + } else { + body.stop().animate({scrollTop: filter3[count].offsetTop}, 500, 'swing'); + } // select class add use enter key if(filter3[count].closest('.vp-field')) { filter3[count].closest('.vp-field').classList.add('vp_select');