$(function(){ }) function myfunc(e) { $(e).trigger('click'); } // init cubeportfolio //var pagers = '#js-filters-products,'+$('#pagers').data('pagers'); $(".xyz").each(function(e){ $(this).addClass('d-none').removeClass('d-flex'); }); $('#js-grid-products').cubeportfolio({ filters: '#js-filters-products, #pager-0, #pager-7, #pager-11, #pager-14, #pager-15', search: '#js-search-blog-posts' , layoutMode: 'grid', defaultFilter: '*', animationType: 'flipOutDelay', gapHorizontal: 35, gapVertical: 30, gridAdjustment: 'responsive', mediaQueries: [{ width: 1500, cols: 5, }, { width: 1100, cols: 4, }, { width: 800, cols: 3, }, { width: 480, cols: 2, options: { caption: '', gapHorizontal: 30, gapVertical: 10, } }], caption: 'overlayBottomPush', displayType: 'sequentially', displayTypeSpeed: 80, // lightbox lightboxDelegate: '.cbp-lightbox', lightboxGallery: true, lightboxTitleSrc: 'data-title', lightboxCounter: '
{{current}} of {{total}}
', // singlePage popup singlePageDelegate: '.cbp-singlePage', singlePageDeeplinking: true, singlePageStickyNavigation: true, singlePageCounter: '
{{current}} of {{total}}
', singlePageCallback: function(url, element) { // to update singlePage content use the following method: this.updateSinglePage(yourContent) var t = this; $.ajax({ url: url, type: 'GET', dataType: 'html', timeout: 30000 }) .done(function(result) { t.updateSinglePage(result); }) .fail(function() { t.updateSinglePage('AJAX Error! Please refresh the page!'); }); }, plugins: { loadMore: { element: '#js-loadMore-juicy-projects', action: 'click', loadItems: 3, }, sort: { element: '#js-sort-products', } }, }); paginador = $('#pagers'); //activate filters for cubeportfolio paginador.on('click', 'a', function (e) { // cache current button clicked var me = $(this).parent(); var catego = $(this).data('category'); // add class cbp-filter-item-active on the current button clicked and remove from other buttons $('.pager-'+catego).removeClass('cbp-filter-item-active').removeClass('active'); me.addClass('active').addClass('cbp-filter-item-active'); // call cubeportfolio filter function $('#js-grid-products').cubeportfolio('filter', me.data('filter')); }); filtro = $('#js-filters-products'); //activate filters for cubeportfolio filtro.on('click', 'span', function (e) { // cache current button clicked //e.preventDefault(); var me = $(this).parent(); var category = me.data('category'); var filtro_cat = me.data('filter'); //var filtro_page = '.page-'+category+'-1'; //console.log(filtro_cat); //$('#js-grid-products').cubeportfolio('filter',filtro_cat); console.log(category); $('#pagers').attr('data-current','init-'+category); // add class cbp-filter-item-active on the current button clicked and remove from other buttons //$('.category-filter').removeClass('cbp-filter-item-active'); //me.addClass('cbp-filter-item-active'); // call cubeportfolio filter function $('nav[id*="pager-"]').each(function(){ //console.log($(this).attr('id')); $(this).removeClass('d-flex'); $(this).addClass('d-none'); if($(this).attr('id') == "pager-"+category){ $(this).removeClass('d-none').addClass('d-flex'); //console.log($(this).attr('class')); }else{ //console.log("* "+$(this).attr('class')); } }); //me.trigger('click'); /* if(category){ var boton = '#init-'+category; console.log(boton); setTimeout(myfunc(category), 1000); } */ //$('#js-grid-products').cubeportfolio('filter',filtro_page); }); jQuery("#js-grid-products").on('initComplete.cbp', function() { console.log('Grilla Cargada'); $("#pager-0").removeClass('d-none').addClass('d-flex'); // your functionality }); jQuery("#js-grid-products").on('filterComplete.cbp', function() { var inicio = $('#pagers').attr('data-current'); /*if(inicio){ $('#pagers').attr('data-current','0'); $('#'+inicio).trigger('click',function(e){ console.log('Paginador Ejecutado'); }); console.log('data-current: '+$('#pagers').attr('data-current')); }*/ console.log('Filtro Completado'); //$("#pager-0").removeClass('d-none').addClass('d-flex'); // your functionality }); $(function(){ if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { $('html, body').animate({ scrollTop: 300, scrollLeft: 0 }, 1000); } }) $(function(){ }) $(function(){ })