PageSourceSearch

https://ksbus.com.tw/js/custom.js

js ksbus.com.tw collected 2026-10-02 08:02:08 UTC 11,982 bytes, 406 lines download raw bytes

1;(function($, window, undefined) {
2
3	"use strict";
4
5	jQuery(document).ready(function ($) {
6
7
8
9		$(document).on('scroll', function () {
10		    // if the scroll distance is greater than 100px
11		    if ($(window).scrollTop() > 40) {
12		      // do something
13		    	$('.site-header').addClass('scrolled-header');
14		    }
15		    else {
16		    	$('.site-header').removeClass('scrolled-header');
17		    }
18		});
19
20		// Accordion script
21		function close_accordion_section() {
22        $('.accordion .accordion-section-title').removeClass('active');
23        $('.accordion .accordion-section-content').slideUp(300).removeClass('open');
24	    }
25	 
26	    $('.accordion-section-title').click(function(e) {
27	        // Grab current anchor value
28	        var currentAttrValue = $(this).attr('href');
29	 
30	        if($(e.target).is('.active')) {
31	            close_accordion_section();
32	        }else {
33	            close_accordion_section();
34	 
35	            // Add active class to section title
36	            $(this).addClass('active');
37	            // Open up the hidden content panel
38	            $('.accordion ' + currentAttrValue).slideDown(300).addClass('open'); 
39	        }
40	 
41	        e.preventDefault();
42	    });
43	    jQuery('.tabs .tab-links a').on('click', function(e)  {
44	        var currentAttrValue = jQuery(this).attr('href');
45	        // Show/Hide Tabs
46	        jQuery('.tabs ' + currentAttrValue).fadeIn(500).siblings().hide();;
47	 
48	        // Change/remove current tab to active
49	        jQuery(this).parent('li').addClass('active').siblings().removeClass('active');
50	 
51	        e.preventDefault();
52	    });
53
54
55		// Animation on scroll 
56		new WOW().init();
57
58
59		// Portfolio Isotope Filter
60
61		// init Isotope
62		var portfolioGrid = $('#portfolio-grid');
63
64		portfolioGrid.imagesLoaded(function(){
65		    portfolioGrid.isotope({
66			    itemSelector: '.item',
67			    layoutMode: 'fitRows',
68			    "masonry": { "columnWidth": ".portfolio-grid-sizer" }
69			});
70		});
71
72      	// filter functions
73		var filterFns = {
74		    // show if number is greater than 50
75		    numberGreaterThan50: function() {
76		      var number = $(this).find('.number').text();
77		      return parseInt( number, 10 ) > 50;
78		    },
79		    // show if name ends with -ium
80		    ium: function() {
81		      var name = $(this).find('.name').text();
82		      return name.match( /ium$/ );
83		    }
84		};
85
86      	// bind filter button click
87      	$('#projects-filter').on( 'click', 'a', function() {
88		    var filterValue = $( this ).attr('data-filter');
89		    // use filterFn if matches value
90		    filterValue = filterFns[ filterValue ] || filterValue;
91		    portfolioGrid.isotope({ filter: filterValue });
92		    return false;
93		});
94
95      	// change is-checked class on buttons
96		$('#projects-filter').each( function( i, buttonGroup ) {
97	    	var $buttonGroup = $( buttonGroup );
98	    	$buttonGroup.on( 'click', 'a', function() {
99	      		$buttonGroup.find('.active').removeClass('active');
100	      		$( this ).addClass('active');
101	    	});
102	  	});
103
104
105		// Owl Carouse Testimonials
106
107		 var owl = $("#owl-demo");
108 
109		  owl.owlCarousel({
110      		
111      		pagination : true,
112    		paginationNumbers: false,
113      		autoPlay: 5000, //Set AutoPlay to 5 seconds
114		    items : 1, //10 items above 1000px browser width
115		    itemsDesktop : [1000,1], //5 items between 1000px and 901px
116		    itemsDesktopSmall : [900,1], // betweem 900px and 601px
117		    itemsTablet: [600,1], //2 items between 600 and 0
118		    itemsMobile : false // itemsMobile disabled - inherit from itemsTablet option
119		  });
120
121		  var owl = $("#owl-blog");
122 
123		  owl.owlCarousel({
124
125		  	  pagination: false,
126		  	  navigation: true,
127		  	  autoPlay: false, //Set AutoPlay to 3 seconds
128		      items : 5, //10 items above 1000px browser width
129		      itemsDesktop : [1000,4], //5 items between 1000px and 901px
130		      itemsDesktopSmall : [900,2], // betweem 900px and 601px
131		      itemsTablet: [600,1], //2 items between 600 and 0
132		      itemsMobile : false // itemsMobile disabled - inherit from itemsTablet option
133		  });
134
135		  var owl = $("#owl-similar");
136 
137		  owl.owlCarousel({
138      		
139      		pagination : false,
140    		paginationNumbers: false,
141      		autoPlay: 5000, //Set AutoPlay to 5 seconds
142		    items : 4, //10 items above 1000px browser width
143		    itemsDesktop : [1000,3], //5 items between 1000px and 901px
144		    itemsDesktopSmall : [900,2], // betweem 900px and 601px
145		    itemsTablet: [600,1], //2 items between 600 and 0
146		    itemsMobile : false // itemsMobile disabled - inherit from itemsTablet option
147		  });
148
149		  var owl = $("#owl-clients");
150 
151		  owl.owlCarousel({
152
153		  	  pagination: true,
154		  	  autoPlay: 3000, //Set AutoPlay to 3 seconds
155		      items : 6, //10 items above 1000px browser width
156		      itemsDesktop : [1000,4], //5 items between 1000px and 901px
157		      itemsDesktopSmall : [900,3], // betweem 900px and 601px
158		      itemsTablet: [600,2], //2 items between 600 and 0
159		      itemsMobile : false // itemsMobile disabled - inherit from itemsTablet option
160		  });
161		 
162		  // Custom Navigation Events
163		  $(".next").on('click' ,function(){
164		    owl.trigger('owl.next');
165		  })
166		  $(".prev").on('click' ,function(){
167		    owl.trigger('owl.prev');
168		  })
169		  $(".play").on('click', function(){
170		    owl.trigger('owl.play',1000); //owl.play event accept autoPlay speed as second parameter
171		  })
172		  $(".stop").on('click', function(){
173		    owl.trigger('owl.stop');
174		  })
175
176
177		// Flex Slider 
178		$(window).load(function() {
179		  // The slider being synced must be initialized first
180		  $('#car-carousel').flexslider({
181		    animation: "slides",
182		    controlNav: false,
183		    directionNav: false,   
184		    animationLoop: false,
185		    slideshow: false,
186		    itemWidth: 115,
187		    itemMargin: 4,
188		    asNavFor: '#car-flexslider'
189		  });
190		 
191		  $('#car-flexslider').flexslider({
192		    animation: "slides",
193		    controlNav: false,
194		    directionNav: false,
195		    animationLoop: false,
196		    slideshow: false,
197		    sync: "#car-carousel"
198		  });
199		});
200
201	  	$(window).load(function() {
202	 		 $('.futured-post').flexslider({
203	    		animation: "slide",
204	    		controlNav: true,         
205				directionNav: false, 
206				slideshow: true,
207				slideshowSpeed: 5000,            
208	  		});
209		});
210
211
212
213		// Submenu Show/Hide
214        // $('nav.main-navigation ul > li, nav.main-navigation ul > li > ul > li').hover(function () {
215        //     $(this).children('ul').stop(true, true).slideDown(200);
216        // }, function () {
217        //     $(this).children('ul').stop(true, true).slideUp(200);
218        // });
219
220		
221		$('nav.main-navigation > ul > li').each(function(){
222			$(this).find('.has-submenu').append('<i class="fa fa-angle-down"></i>');
223		});
224
225
226        // Blog Masonry
227        var blogIsotope=function(){
228            var imgLoad = imagesLoaded($('.blog-isotope'));
229		   
230            imgLoad.on('done',function(){
231
232                $('.blog-isotope').isotope({
233                    "itemSelector": ".blog-post",
234                });
235               
236            })
237           
238           imgLoad.on('fail',function(){
239
240                $('.blog-isotope').isotope({
241                    "itemSelector": ".blog-post",
242                });
243
244           })  
245           
246        }
247                   
248        blogIsotope();
249
250
251
252        // Flickr Images
253        $('.flickr-images').jflickrfeed({
254			limit: 6 ,
255			qstrings: {id: '23199621@N02'},
256			itemTemplate: '<li class="small-thumb"><a href="{{link}}" title="{{title}}"><img src="{{image_s}}" alt="{{title}}" /></a></li>'
257		});
258
259
260
261		// Off Canvas Navigation
262		var offcanvas_open = false;
263		var offcanvas_from_left = false;
264
265		function offcanvas_right() {
266			
267			$(".sidebar-menu-container").addClass("slide-from-left");
268			$(".sidebar-menu-container").addClass("sidebar-menu-open");		
269			
270			offcanvas_open = true;
271			offcanvas_from_left = true;
272			
273			$(".sidebar-menu").addClass("open");
274			$("body").addClass("offcanvas_open offcanvas_from_left");
275
276			$(".nano").nanoScroller();
277			
278		}
279
280		function offcanvas_close() {
281			if (offcanvas_open === true) {
282					
283				$(".sidebar-menu-container").removeClass("slide-from-left");
284				$(".sidebar-menu-container").removeClass("sidebar-menu-open");
285				
286				offcanvas_open = false;
287				offcanvas_from_left = false;
288				
289				//$('#sidebar-menu-container').css('max-height', 'inherit');
290				$(".sidebar-menu").removeClass("open");
291				$("body").removeClass("offcanvas_open offcanvas_from_left");
292
293			}
294		}
295
296		$(".side-menu-button").on('click', function() {
297			offcanvas_right();
298		});
299
300		$("#sidebar-menu-container").on("click", ".sidebar-menu-overlay", function(e) {
301			offcanvas_close();
302		});
303
304		$(".sidebar-menu-overlay").swipe({
305			swipeLeft:function(event, direction, distance, duration, fingerCount) {
306				offcanvas_close();
307			},
308			swipeRight:function(event, direction, distance, duration, fingerCount) {
309				offcanvas_close();
310			},
311			tap:function(event, direction, distance, duration, fingerCount) {
312				offcanvas_close();
313			},
314			threshold:0
315		});
316
317
318		// Mobile navigation
319		$(".responsive-menu .menu-item-has-children").append('<div class="show-submenu"><i class="fa fa-angle-down"></i></div>');
320
321	    $(".responsive-menu").on("click", ".show-submenu", function(e) {
322			e.stopPropagation();
323			
324			$(this).parent().toggleClass("current")
325							.children(".sub-menu").toggleClass("open");
326							
327			$(this).html($(this).html() == '<i class="fa fa-angle-down"></i>' ? '<i class="fa fa-angle-up"></i>' : '<i class="fa fa-angle-down"></i>');
328			$(".nano").nanoScroller();
329		});
330
331		$(".responsive-menu").on("click", "a", function(e) {
332			if( ($(this).attr('href') === "#") || ($(this).attr('href') === "") ) {
333				$(this).parent().children(".show-submenu").trigger("click");
334				return false;
335			} else {
336				offcanvas_close();
337			}
338		});
339
340
341		// revolution slider
342		$('.fullwidthbanner').revolution({
343        	delay:6000,
344        	startwidth:1170,
345        	startheight:680,
346        	onHoverStop: "off",
347        	hideTimerBar: "on",
348            thumbWidth: 100,
349            thumbHeight: 50,
350            thumbAmount: 3,
351            hideThumbs: 200,
352            navigationType: "bullet",
353            navigationArrows: "verticalcentered",
354            navigationStyle: "preview4",
355            touchenabled: "on",
356            navOffsetHorizontal: 0,
357            navOffsetVertical: 20,
358            stopAtSlide: -1,
359            stopAfterLoops: -1,
360            hideCaptionAtLimit: 0,
361            hideAllCaptionAtLilmit: 0,
362            hideSliderAtLimit: 0,
363            hideThumbsOnMobile:"on",
364         	hideNavDelayOnMobile:1500,
365         	hideBulletsOnMobile:"on",
366         	hideArrowsOnMobile:"on",
367         	hideThumbsUnderResoluition:0,
368            fullWidth: "on",
369            shadow: 0
370      	});
371
372
373
374		//  go to top
375      	var offset = 300,
376		//browser window scroll (in pixels) after which the "back to top" link opacity is reduced
377		offset_opacity = 1200,
378		//duration of the top scrolling animation (in ms)
379		scroll_top_duration = 700,
380		//grab the "back to top" link
381		$back_to_top = $('.go-top');
382
383		//hide or show the "back to top" link
384		$(window).on('scroll', function(){
385			( $(this).scrollTop() > offset ) ? $back_to_top.addClass('go-top-visible') : $back_to_top.removeClass('go-top-visible go-top-fade-out');
386			if( $(this).scrollTop() > offset_opacity ) { 
387				$back_to_top.addClass('go-top-fade-out');
388			}
389		});
390
391		//smooth scroll to top
392		$back_to_top.on('click', function(event){
393			event.preventDefault();
394			$('body,html').animate({
395				scrollTop: 0 ,
396			 	}, scroll_top_duration
397			);
398		});
399
400		
401		
402
403
404	});
405
406})(jQuery, window);

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.