1(function ($) { 2 "use stict"; 3 var count = 1; 4 var portfolioPostsPerPage = $(".grid-item").length; 5 var totalNumberOfPortfolioPages = Math.ceil(parseInt(ajax_var_portfolio.total) / portfolioPostsPerPage); 6 var currentPosition = $(window).scrollTop(); 7 8 $(window).on('scroll', function () { 9 if (!$(".elementor-html").length) { //Don't load in Elementor Edit mode 10 var scroll = $(window).scrollTop(); 11 if (scroll > currentPosition) { //Load only on scroll down 12 loadMorePortfolioItemsOnScroll(); 13 } 14 currentPosition = scroll; 15 } 16 }); 17 18 setPrettyPhoto(); 19 showHidePortfolioLoadMoreButton(); 20 loadMorePortfolioOnClick(); 21 22 $(window).on('load', function () { 23 imageSliderSettings(); 24 isotopeSetUp(); 25 }); 26 27 28 function isotopeSetUp() { 29 $('.grid').isotope({ 30 itemSelector: '.grid-item', 31 transitionDuration: 0, 32 masonry: { 33 columnWidth: '.grid-sizer' 34 } 35 }); 36 $('.grid').isotope('layout'); 37 } 38 39 function showHidePortfolioLoadMoreButton() { 40 if (portfolioPostsPerPage < parseInt(ajax_var_portfolio.total)) { 41 $('.more-posts-portfolio').css('visibility', 'visible'); 42 $('.more-posts-portfolio').animate({opacity: 1}, 1500); 43 } else { 44 $('.more-posts-portfolio').css('display', 'none'); 45 } 46 } 47 48 function loadMorePortfolioOnClick() { 49 $('.more-posts-portfolio:visible').on('click', function () { 50 count++; 51 loadPortfolioMoreItems(count, portfolioPostsPerPage); 52 $('.more-posts-portfolio').css('display', 'none'); 53 $('.more-posts-portfolio-loading').css('display', 'inline-block'); 54 }); 55 } 56 57 function loadPortfolioMoreItems(pageNumber, portfolioPostsPerPage) { 58 $.ajax({
59 url: ajax_var_portfolio.url, 60 type: 'POST', 61 data: "action=portfolio_ajax_load_more&portfolio_page_number=" + pageNumber + "&portfolio_posts_per_page=" + portfolioPostsPerPage + "&security=" + ajax_var_portfolio.nonce, 62 success: function (html) { 63 var $newItems = $(html); 64 $('.grid').append($newItems); 65 $('.grid').imagesLoaded(function () { 66 $('.grid').isotope('appended', $newItems); 67 animateElement(); 68 if (count == totalNumberOfPortfolioPages) 69 { 70 $('.more-posts-portfolio').css('display', 'none'); 71 $('.more-posts-portfolio-loading').css('display', 'none'); 72 $('.no-more-posts-portfolio').css('display', 'inline-block'); 73 } else 74 { 75 $('.more-posts-portfolio').css('display', 'inline-block'); 76 $('.more-posts-portfolio-loading').css('display', 'none'); 77 $(".more-posts-portfolio-holder").removeClass('stop-loading'); 78 } 79 }); 80 setPrettyPhoto(); 81 } 82 }); 83 return false; 84 } 85 86 function loadMorePortfolioItemsOnScroll() { 87 $(".more-posts-portfolio-holder.scroll").not('.stop-loading').each(function () { 88 var top_of_object = $(this).offset().top; 89 var bottom_of_window = $(window).scrollTop() + $(window).height(); 90 if ((bottom_of_window - 70) > top_of_object) { 91 $(this).addClass('stop-loading'); 92 count++; 93 loadPortfolioMoreItems(count, portfolioPostsPerPage); 94 $('.more-posts-portfolio-loading').css('display', 'inline-block'); 95 } 96 }); 97 } 98 99 function setPrettyPhoto() { 100 $('a[data-rel]').each(function () { 101 $(this).attr('rel', $(this).data('rel')); 102 }); 103 $("a[rel^='prettyPhoto']").prettyPhoto({ 104 slideshow: false, 105 overlay_gallery: false, 106 default_width: 1280, 107 default_height: 720, 108 deeplinking: false, 109 social_tools: false, 110 iframe_markup: '<iframe src ="{path}" width="{width}" height="{height}" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>' 111 }); 112 } 113 114 function imageSliderSettings() { 115 $(".simple-image-slider-wrapper").each(function () { 116 var id = $(this).attr('id'); 117 var auto_value = $(this).data('auto'); 118 var speed_value = $(this).data('speed'); 119 if (auto_value === true) { 120 var mySwiper = new Swiper('#' + id, { 121 autoplay: { 122 delay: speed_value 123 }, 124 slidesPerView: 1, 125 pagination: { 126 el: '.swiper-pagination-' + id, 127 clickable: true 128 } 129 }); 130 $('#' + id).hover(function () { 131 mySwiper.autoplay.stop(); 132 }, function () { 133 mySwiper.autoplay.start(); 134 }); 135 } else { 136 var mySwiper = new Swiper('#' + id, { 137 slidesPerView: 1, 138 pagination: { 139 el: '.swiper-pagination-' + id, 140 clickable: true 141 } 142 }); 143 } 144 }); 145 } 146 147 function animateElement(e) { 148 $(".animate").each(function (i) { 149 var top_of_object = $(this).offset().top; 150 var bottom_of_window = $(window).scrollTop() + $(window).height(); 151 if ((bottom_of_window - 70) > top_of_object) { 152 $(this).addClass('show-it'); 153 } 154 }); 155 } 156 157})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.