แค็ตตาล็อคโปรโมชั่น
GRANDHOME Mid Year EXPO
ช้อปกลางปี กับดิลฟ้าผ่า
1 พ.ค. - 30 มิ.ย. 67
ซื้อเครื่องกรองน้ำชัวร์
แลกซื้อไส้กรอง ลดทันที 50%
แค็ตตาล็อคสินค้า Bathroom’s Story
VICTOR Terrazzo Collection
require([
"jquery",
"mage/translate"
], function($){
var count1 = $('.promotion-catalog-first .catalog-first').length;
var count2 = $('.promotion-catalog-second .catalog-second').length;
var count3 = $('.promotion-catalog-third .catalog-third').length;
var count4 = $('.promotion-catalog-fourth .catalog-fourth').length;
if(count1 > 4)
{
$(".catalog-first:lt(4)").css("display","block");
$(".show-all-1").css('display','block');
$('.show-all-1').click(function(){
for (var i = 5; i <= count1; i=i+4) {
$(".catalog-first:nth-child("+i+")").css("display","table");
$(".catalog-first:nth-child("+i+")").css("clear","both");
};
$(".catalog-first").css('display','block');
$(".show-all-1").css('display','none');
$(".show-less-1").css('display','block');
});
$('.show-less-1').click(function(){
$(".catalog-first:gt(3)").css("display","none");
$(".catalog-first:gt(3)").css("clear","unset");
$(".show-all-1").css('display','block');
$(".show-less-1").css('display','none');
});
}else {
$(".catalog-first").css("display","block");
}
if(count2 > 4)
{
$(".catalog-second:lt(4)").css("display","block");
$(".show-all-2").css('display','block');
$('.show-all-2').click(function(){
for (var i = 5; i <= count2; i=i+4) {
$(".catalog-second:nth-child("+i+")").css("display","table");
$(".catalog-second:nth-child("+i+")").css("clear","both");
};
$(".catalog-second").css('display','block');
$(".show-all-2").css('display','none');
$(".show-less-2").css('display','block');
});
$('.show-less-2').click(function(){
$(".catalog-second:gt(3)").css("display","none");
$(".catalog-second:gt(3)").css("clear","unset");
$(".show-all-2").css('display','block');
$(".show-less-2").css('display','none');
});
}else {
$(".catalog-second").css("display","block");
}
if(count3 > 4)
{
$(".catalog-third:lt(4)").css("display","block");
$(".show-all-3").css('display','block');
$('.show-all-3').click(function(){
for (var i = 5; i <= count3; i=i+4) {
$(".catalog-third:nth-child("+i+")").css("display","table");
$(".catalog-third:nth-child("+i+")").css("clear","both");
};
$(".catalog-third").css('display','block');
$(".show-all-3").css('display','none');
$(".show-less-3").css('display','block');
});
$('.show-less-3').click(function(){
$(".catalog-third:gt(3)").css("display","none");
$(".catalog-third:gt(3)").css("clear","unset");
$(".show-all-3").css('display','block');
$(".show-less-3").css('display','none');
});
}else {
$(".catalog-third").css("display","block");
}
if(count4 > 4)
{
$(".catalog-fourth:lt(4)").css("display","block");
$(".show-all-4").css('display','block');
$('.show-all-4').click(function(){
for (var i = 5; i <= count4; i=i+4) {
$(".catalog-fourth:nth-child("+i+")").css("display","table");
$(".catalog-fourth:nth-child("+i+")").css("clear","both");
};
$(".catalog-fourth").css('display','block');
$(".show-all-4").css('display','none');
$(".show-less-4").css('display','block');
});
$('.show-less-4').click(function(){
$(".catalog-fourth:gt(3)").css("display","none");
$(".catalog-fourth:gt(3)").css("clear","unset");
$(".show-all-4").css('display','block');
$(".show-less-4").css('display','none');
});
}else {
$(".catalog-fourth").css("display","block");
}
});