Page 1 of 1

How to check which breakpoint is used from javascript

Posted: Sat Feb 26, 2022 7:23 pm
by bzc0fq@gmail.com
Hi,

I was looking for an answer for some time, but could not find it... so...
I have a general question on how to check which breakpoint is used using javascript?
I need this to update a table that has different name for different breakpoints.
...or, is there a way to check whether a table is visible or is on - on given breakpoint?

Thanks in advance for your help and time.

Re: How to check which breakpoint is used from javascript

Posted: Sun Feb 27, 2022 7:50 am
by bzc0fq@gmail.com
I am not sure whether this will work precisely, but I have used $(document).width() to detect the document resolution...
then set a variable pointing to the table and do the things on the table...

if ($(document).width() < 1400) {
var tblProdukty = $("#tblProdukty1280");
} else {
var tblProdukty = $("#tblProdukty1920");
}

tblProdukty.find("tbody").empty();
tblProdukty.find("tbody").append ('....') //etc... do the job.

Hope this will help :)

Re: How to check which breakpoint is used from javascript

Posted: Sun Feb 27, 2022 8:27 am
by Pablo
I think this is correct.