1/** 2 * @package Stability Responsive HTML5 Template 3 * 4 * Template Scripts 5 * Created by Dan Fisher 6 7 Init JS 8 9 1. Main Navigation 10 2. Isotope 11 3. Magnific Popup 12 4. Flickr 13 5. Carousel (based on owl carousel plugin) 14 6. Content Slider (based on owl carousel plugin) 15 7. FitVid (responsive video) 16 8. Sticky Header 17 9. Shape Boxes 18 10. SelfHosted Audio & Video 19 11. Parallax Background 20 12. Circle Counter 21 13. Header Transparent 22*/ 23 24;(function($){ 25 "use strict"; 26 27 28 /* ----------------------------------------------------------- */ 29 /* 1. Main Navigation 30 /* ----------------------------------------------------------- */ 31 32 33 // Menu drop down effect 34 $('.dropdown-toggle').dropdownHover().dropdown(); 35 $(document).on('click', '.fhmm .dropdown-menu', function(e) { 36 e.stopPropagation() 37 }); 38 39 $('.navbar-toggle').on('click', function () { 40 $('.navbar-collapse').collapse('toggle'); 41 }); 42 43 44 /* ----------------------------------------------------------- */ 45 /* 2. Isotope 46 /* ----------------------------------------------------------- */ 47 48 // Isotope containers 49 var $container = $('.project-feed, .masonry-feed'); 50 51 // initialize Isotope after all images have loaded 52 $container.imagesLoaded( function() { 53 var $filter = $('.project-feed-filter'); 54 55 $container.isotope({ 56 filter : '*', 57 resizable : false, 58 layoutMode: 'masonry', 59 itemSelector: '.project-item, .masonry-item' 60 }); 61 62 // filter items on button click 63 $filter.on( 'click', 'a', function() { 64 var filterValue = $(this).attr('data-filter'); 65 $filter.find('a').removeClass('btn-primary').addClass('btn-default'); 66 $(this).addClass('btn-primary').removeClass('btn-default'); 67 $container.isotope({ 68 filter: filterValue 69 }); 70 return false; 71 }); 72 73 }); 74 75 76 77 /* ----------------------------------------------------------- */ 78 /* 3. Magnific Popup 79 /* ----------------------------------------------------------- */ 80 $('.popup-link').magnificPopup({ 81 type:'image', 82 // Delay in milliseconds before popup is removed 83 removalDelay: 300, 84 85 gallery:{ 86 enabled:true 87 }, 88 89 // Class that is added to popup wrapper and background 90 // make it unique to apply your CSS animations just to this exact popup 91 mainClass: 'mfp-fade' 92 }); 93 94 95 96 /* ----------------------------------------------------------- */ 97 /* 4. Flickr 98 /* ----------------------------------------------------------- */ 99 100 $('.flickr-feed').jflickrfeed({ 101 limit: 9, 102 qstrings: { 103 id: '52617155@N08' 104 }, 105 itemTemplate: '<li><a href="{{link}}" target="_blank"><img src="{{image_s}}" alt="{{title}}" /></a></li>' 106 }, 107 function(data) { 108 $(".flickr-feed li:nth-child(3n)").addClass("nomargin"); 109 }); 110 111 112 113 /* ----------------------------------------------------------- */ 114 /* 5. Carousel (based on owl carousel plugin) 115 /* ----------------------------------------------------------- */ 116 var owl = $("#owl-carousel"); 117 118 owl.owlCarousel({ 119 items : 4, //4 items above 1000px browser width 120 itemsDesktop : [1000,4], //4 items between 1000px and 901px 121 itemsDesktopSmall : [900,2], // 4 items betweem 900px and 601px 122 itemsTablet: [600,2], //2 items between 600 and 0; 123 itemsMobile : [480,1], // itemsMobile disabled - inherit from itemsTablet option 124 pagination : false, 125 scrollPerPage: false 126 }); 127 128 // Custom Navigation Events 129 $("#carousel-next").click(function(){ 130 owl.trigger('owl.next'); 131 }); 132 $("#carousel-prev").click(function(){ 133 owl.trigger('owl.prev'); 134 }); 135 136 137 // carousel with 3 elements 138 (function($) { 139 var owl = $(".owl-carousel-3"); 140 141 owl.owlCarousel({ 142 items : 3, //3 items above 1000px browser width 143 itemsDesktop : [1000,2], //4 items between 1000px and 901px 144 itemsDesktopSmall : [900,2], // 4 items betweem 900px and 601px 145 itemsTablet: [600,2], //2 items between 600 and 0; 146 itemsMobile : [480,1], // itemsMobile disabled - inherit from itemsTablet option 147 pagination : false 148 }); 149 150 // Custom Navigation Events 151 $("#carousel-next-alt").click(function(){ 152 owl.trigger('owl.next'); 153 }); 154 $("#carousel-prev-alt").click(function(){ 155 owl.trigger('owl.prev'); 156 }); 157 })(jQuery); 158 159 160 161 /* ----------------------------------------------------------- */ 162 /* 6. Content Slider (based on owl carousel plugin) 163 /* ----------------------------------------------------------- */ 164 $(".owl-slider").owlCarousel({ 165 166 navigation : true, // Show next and prev buttons 167 slideSpeed : 300, 168 paginationSpeed : 400, 169 singleItem:true, 170 navigationText: ["<i class='fa fa-chevron-left'></i>","<i class='fa fa-chevron-right'></i>"], 171 pagination: true, 172 autoPlay : false 173 174 }); 175 176 177 178 /* ----------------------------------------------------------- */ 179 /* 7. FitVid (responsive video) 180 /* ----------------------------------------------------------- */ 181 $(".video-holder, .audio-holder").fitVids(); 182 183 184 /* ----------------------------------------------------------- */ 185 /* -- Misc 186 /* ----------------------------------------------------------- */ 187 188 $('.title-accent > h3').each(function(){ 189 var me = $(this); 190 me.html(me.html().replace(/^(\w+)/, '<span>$1</span>')); 191 }); 192 193 // Back to Top 194 $("#back-top").hide(); 195 196 if($(window).width() > 991) { 197 $('body').append('<div id="back-top"><a href="#top"><i class="fa fa-chevron-up"></i></a></div>') 198 $(window).scroll(function () { 199 if ($(this).scrollTop() > 100) { 200 $('#back-top').fadeIn(); 201 } else { 202 $('#back-top').fadeOut(); 203 } 204 }); 205 206 // scroll body to 0px on click 207 $('#back-top a').click(function(e) { 208 e.preventDefault(); 209 $('body,html').animate({ 210 scrollTop: 0 211 }, 400); 212 return false; 213 }); 214 }; 215 216 // Animation on scroll 217 var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 218 if (isMobile == false) { 219 220 $("[data-animation]").each(function() { 221 222 var $this = $(this); 223 224 $this.addClass("animation"); 225 226 if(!$("html").hasClass("no-csstransitions") && $(window).width() > 767) { 227 228 $this.appear(function() { 229
230 var delay = ($this.attr("data-animation-delay") ? $this.attr("data-animation-delay") : 1); 231 232 if(delay > 1) $this.css("animation-delay", delay + "ms"); 233 $this.addClass($this.attr("data-animation")); 234 235 setTimeout(function() { 236 $this.addClass("animation-visible"); 237 }, delay); 238 239 }, {accX: 0, accY: -170}); 240 241 } else { 242 243 $this.addClass("animation-visible"); 244 245 } 246 247 }); 248 } 249 250 251 /* ----------------------------------------------------------- */ 252 /* 8. Sticky Header 253 /* ----------------------------------------------------------- */ 254 255 // Set options 256 var headerSticky = $('header.header'); 257 // Check for sticky header 258 if ( headerSticky.hasClass('header-default') || headerSticky.hasClass('header-transparent') || headerSticky.hasClass('menu-colored') || headerSticky.hasClass('menu-pills') ) { 259 var options = { 260 261 offset: 400, // OR â offset: '.classToActivateAt', 262 263 // Callbacks 264 onInit: function() { 265 // Menu drop down effect 266 $('.dropdown-toggle').dropdownHover().dropdown(); 267 $(document).on('click', '.fhmm .dropdown-menu', function(e) { 268 e.stopPropagation() 269 }); 270 }, 271 272 throttle: 200, 273 274 onStick: function() {}, 275 onUnstick: function() {}, 276 onDestroy: function() {}, 277 278 }; 279 // Create a new instance of Headhesive 280 var headhesive = new Headhesive('header.header', options); 281 } 282 283 284 285 /* ----------------------------------------------------------- */ 286 /* 9. Shape Boxes 287 /* ----------------------------------------------------------- */ 288 function init() { 289 var speed = 250, 290 easing = mina.easeinout; 291 292 [].slice.call ( document.querySelectorAll( '.shape-item' ) ).forEach( function( el ) { 293 var s = Snap( el.querySelector( 'svg' ) ), path = s.select( 'path' ), 294 pathConfig = { 295 from : path.attr( 'd' ), 296 to : el.getAttribute( 'data-path-hover' ) 297 }; 298 299 el.addEventListener( 'mouseenter', function() { 300 path.animate( { 'path' : pathConfig.to }, speed, easing ); 301 } ); 302 303 el.addEventListener( 'mouseleave', function() { 304 path.animate( { 'path' : pathConfig.from }, speed, easing ); 305 } ); 306 } ); 307 } 308 init(); 309 310 311 312 /* ----------------------------------------------------------- */ 313 /* 10. SelfHosted Audio & Video 314 /* ----------------------------------------------------------- */ 315 $('audio,video').mediaelementplayer({ 316 videoWidth: '100%', 317 videoHeight: '100%', 318 audioWidth: '100%', 319 features: ['playpause','progress','tracks','volume'], 320 videoVolume: 'horizontal' 321 }); 322 323 324 325 /* ----------------------------------------------------------- */ 326 /* 11. Parallax Background 327 /* ----------------------------------------------------------- */ 328 if($(".parallax-bg").get(0) && $(window).width() > 991) { 329 if(!Modernizr.touch) { 330 $(window).stellar({ 331 responsive:true, 332 scrollProperty: 'scroll', 333 parallaxElements: false, 334 horizontalScrolling: false, 335 horizontalOffset: 0, 336 verticalOffset: 0 337 }); 338 } else { 339 $(".parallax-bg").addClass("disabled"); 340 } 341 } 342 343 344 /* ----------------------------------------------------------- */ 345 /* 12. Circle Counter 346 /* ----------------------------------------------------------- */ 347 348 $(".circled-counter").each(function() { 349 var $this = $(this); 350 $this.appear(function() { 351 $this.circliful(); 352 }, {accX: 0, accY: 100}); 353 }); 354 355 356 357 /* ----------------------------------------------------------- */ 358 /* 13. Header Transparent 359 /* ----------------------------------------------------------- */ 360 if($('.header').hasClass('header-transparent') || $('.header').hasClass('header-fixed')) { 361 $(window).scroll(function() { 362 var scroll = $(window).scrollTop(); 363 364 if (scroll >= 400) { 365 $(".header:not(.headhesive)").addClass("hidden"); 366 } else { 367 $(".header:not(.headhesive)").removeClass("hidden"); 368 } 369 });
370 }; 371 372})(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.