👁 查看:megnorloadmore.js
路径:/home/forge/kingkrunch.com/wp/wp-content/themes/foodstuff/js/megnor/megnorloadmore.js
大小:3.06 KB · 修改:2020-09-11 16:13:49 · 权限:0775 · 可写
// JavaScript Document
// JS for calling load more for home page product
jQuery(document).ready(function () {
"use strict";
var size_li = jQuery(".woofeature .products li").size();
var size_li_new = jQuery(".woonew .products li").size();
var size_li_best = jQuery(".woobest .products li").size();
var size_li_sale = jQuery(".woosale .products li").size();
var counter=parseInt(php_var.tm_loadmore);
var x=8;
var y=8;
var z=8;
var a=8;
jQuery('.woofeature .products li:lt('+x+')').fadeIn('slow');
jQuery('.woonew .products li:lt('+y+')').fadeIn('slow');
jQuery('.woobest .products li:lt('+z+')').fadeIn('slow');
jQuery('.woosale .products li:lt('+a+')').fadeIn('slow');
jQuery('.woofeature .woocount').click(function () {
if(x==size_li){
jQuery('.woofeature .woocount').hide();
jQuery('.woofeature .tm-message').show();
}else{
x= (x+counter <= size_li) ? x+counter : size_li;
jQuery('.woofeature .products li:lt('+x+')').fadeIn(1000);
}
});
jQuery('.woonew .woocount').click(function () {
if(y==size_li_new){
jQuery('.woonew .woocount').hide();
jQuery('.woonew .tm-message').show();
}else{
y= (y+counter <= size_li_new) ? y+counter : size_li_new;
jQuery('.woonew .products li:lt('+y+')').fadeIn('slow');
}
});
jQuery('.woobest .woocount').click(function () {
if(z==size_li_best){
jQuery('.woobest .woocount').hide();
jQuery('.woobest .tm-message').show();
}else{
z= (z+counter <= size_li_best) ? z+counter : size_li_best;
jQuery('.woobest .products li:lt('+z+')').fadeIn('slow');
}
});
jQuery('.woosale .woocount').click(function () {
if(a==size_li){
jQuery('.woosale .woocount').hide();
jQuery('.woosale .tm-message').show();
}else{
a= (a+counter <= size_li) ? a+counter : size_li;
jQuery('.woosale .products li:lt('+a+')').fadeIn(1000);
}
});
});
// JS for Load more for shop page product
jQuery(document).ready(function () {
"use strict";
var checkpagination=php_var.tm_pagination;
if(checkpagination=='no'){
jQuery('.archive #content .products li').hide();
jQuery('.woocommerce-pagination').hide();
var size_li_grid = jQuery("#content .products li").size();
var nomore=php_var.tm_nomore;
jQuery('.archive #content .products').after('<div class="loadgridlist-wrapper"><span class="loadgridlist">'+php_var.tm_viewmore+'</span></div><div class="tm-message" style="display: block;"><i class="fa fa-frown-o"></i> ' + nomore + '</div>');
jQuery('.tm-message').hide();
var counter=parseInt(php_var.tm_loadmore);
var m=12;
jQuery('.archive #content .products li:lt('+m+')').fadeIn('slow');
jQuery('.loadgridlist').click(function () {
if(m==size_li_grid){
jQuery('.loadgridlist').hide();
jQuery('.tm-message').show();
}else{
m= (m+counter <= size_li_grid) ? m+counter : size_li_grid;
jQuery('.archive #content .products li:lt('+m+')').fadeIn('slow');
}
});
}
});