Using jQuery with Tablepress to get table offset()
-
Hi, I want to make a table fixed on a page as the page starts to scroll. The table is not intitally in view but as the user scrolls down it comes into view and once it gets to the top of the page I want it to stay there. I’ve found some code which will do this and it uses jQuery to locate and fixed the position of the table. The following Code Snippet – another great plugin – contains my Javascript / jQuery code
if (jQuery("div#tablepress-7_wrapper")){
console.log("Hello World");
let tp7_wrap = jQuery("div#tablepress-7_wrapper");
console.log(jQuery("div#tablepress-7_wrapper").html());
}The code is inside a jquery(document)ready statement to make sure that the page is fully loaded prior to the interrogation of the element. “Hello World” prints to the console, so the previous line is working but when I try to read any property of the tablepress div element all I get is undefined. Clearly the element is there so why can’t I read any of its properties?
Thanks
Paul
The topic ‘Using jQuery with Tablepress to get table offset()’ is closed to new replies.