I try to do it like that
var matched = $(".gallery_thumbs .woocommerce-product-gallery__image");
console.log(matched.length);
if ((matched < 7) && ($(window).width() > 1024)) {
$('button.gallery_thumbs-toggle').hide();
}
I tried the script by alert
if (($(window).width() > 1024)) {
alert(1);
}
is working fine, but that doesn’t work
if ((matched < 7)){
alert(1);
}
console.log(matched.length) is showing 2, like it is, so it’s less then 7, what’s wrong?
2
Answers
You have to check the
length
. So:if (matched.length < 7)
instead ofif (matched < 7)