Skip to content

Commit

Permalink
Added link-scroll code for sort as well
Browse files Browse the repository at this point in the history
Links of tables generated by sort btns weren't working
  • Loading branch information
LunarMarathon committed Oct 15, 2022
1 parent a27a8da commit 270a443
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,26 @@ function generateTable() {

//Add styling to container
divContainer.classList.add("dynCont");

// Code to scroll down to particular row - Sort-scroll fix>>>>>>>
link = $('.linkrow');
// console.log(link)
link.click(function (e) {
e.preventDefault();
// console.log('clicked');
var rowVal = $(this)[0].innerHTML,
row;
// console.log(rowVal)

row = $('#' + rowVal);
// console.log(row)
if (row.length) {
// console.log(row.offset().top);
// console.log(document.documentElement.scrollHeight / 2);
let y = (row.offset().top)
// console.log(y)
$(window).scrollTop(y)
}
});
//----------------------------------------------------------------
}

0 comments on commit 270a443

Please sign in to comment.