PageSourceSearch

https://cnb1901.com/js/demos/demo-construction-2.js

js cnb1901.com collected 2026-10-02 15:28:41 UTC 2,839 bytes, 138 lines download raw bytes

1/*
2Name: 			Construction 2
3Written by: 	Okler Themes - (http://www.okler.net)
4Theme Version:	9.9.3
5*/
6
7(function ($) {
8
9	'use strict';
10
11	// Load More - Projects
12	var loadMore = {
13
14		pages: 0,
15		currentPage: 1,
16		$wrapper: $('#loadMoreWrapper'),
17		$btn: $('#loadMore'),
18		$btnWrapper: $('#loadMoreBtnWrapper'),
19		$loader: $('#loadMoreLoader'),
20
21		build: function() {
22
23			var self = this
24
25			self.pages = self.$wrapper.data('total-pages');
26
27			if(self.pages <= 1) {
28
29				self.$btnWrapper.remove();
30				return;
31
32			} else {
33
34				// init isotope
35				self.$wrapper.isotope();
36
37				self.$btn.on('click', function() {
38					self.loadMore();
39				});
40
41				// Lazy Load
42				if(self.$btn.hasClass('btn-lazy-load')) {
43					theme.fn.intObs( '#loadMore', "$('#loadMore').trigger('click');", {
44						rootMargin: '0px 0px 0px 0px'
45					} );
46				}
47
48			}
49
50		},
51		loadMore: function() {
52
53			var self = this;
54
55			self.$btn.css('visibility', 'hidden');
56			self.$loader.show();
57
58			// Ajax
59			$.ajax({
60				url: 'ajax/demo-construction-2-ajax-projects-load-more-' + (parseInt(self.currentPage)+1) + '.html',
61				complete: function(data) {
62
63					var $items = $(data.responseText);
64
65					setTimeout(function() {
66
67						self.$wrapper.append($items)
68
69						self.$wrapper.isotope('appended', $items);
70
71						self.currentPage++;
72
73						if(self.currentPage < self.pages) {
74							self.$btn.css('visibility', 'visible').blur();
75						} else {
76							self.$btnWrapper.remove();
77						}
78
79						self.$loader.hide();
80
81					}, 1000);
82
83				}
84			});
85
86		}
87
88	}
89
90	if($('#loadMoreWrapper').get(0)) {
91		loadMore.build();
92	}
93
94	// Thumb Gallery
95	var $customThumbGalleryDetail = $('#customThumbGalleryDetail'),
96		$customThumbGalleryThumbs = $('#customThumbGalleryThumbs'),
97		flag = false,
98		duration = 300;
99
100	$customThumbGalleryDetail
101		.owlCarousel({
102			items: 1,
103			margin: 10,
104			nav: false,
105			dots: false,
106			loop: false,
107			navText: [],
108			rtl: ( $('html').attr('dir') == 'rtl' ) ? true : false
109		})
110		.on('changed.owl.carousel', function(e) {
111			if (!flag) {
112				flag = true;
113				$customThumbGalleryThumbs.trigger('to.owl.carousel', [e.item.index-1, duration, true]);
114				flag = false;
115			}
116		});
117
118	$customThumbGalleryThumbs
119		.owlCarousel({
120			margin: 15,
121			items: 4,
122			nav: false,
123			center: false,
124			dots: false,
125			rtl: ( $('html').attr('dir') == 'rtl' ) ? true : false
126		})
127		.on('click', '.owl-item', function() {
128			$customThumbGalleryDetail.trigger('to.owl.carousel', [$(this).index(), duration, true]);
129		})
130		.on('changed.owl.carousel', function(e) {
131			if (!flag) {
132				flag = true;
133				$customThumbGalleryDetail.trigger('to.owl.carousel', [e.item.index, duration, true]);
134				flag = false;
135			}
136		});
137
138}).apply(this, [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.