1(function($) { 2 "use strict"; 3 var PENCI = PENCI || {}; 4 5 /* General functions 6 ---------------------------------------------------------------*/ 7 PENCI.general = function () { 8 // Top search 9 $( '#top-search a.search-click' ).on( 'click', function () { 10 $( '.show-search' ).fadeToggle(); 11 $( '.show-search input.search-input' ).focus(); 12 } ); 13 14 // Go to top 15 $( '.go-to-top, .penci-go-to-top-floating' ).on( 'click', function () { 16 $( 'html, body' ).animate( { scrollTop: 0 }, 700 ); 17 return false; 18 } ); 19 20 // Lazyload 21 $('.penci-lazy').Lazy({ 22 effect: 'fadeIn', 23 effectTime: 300, 24 scrollDirection: 'both' 25 }); 26 27 // Go to top button 28 var $goto_button = $( '.penci-go-to-top-floating' ); 29 if ( $goto_button.length ) { 30 $(document).scroll(function() { 31 var y = $(this).scrollTop(); 32 if ( y > 300) { 33 $goto_button.addClass('show-up'); 34 } else { 35 $goto_button.removeClass('show-up'); 36 } 37 } ); 38 } 39 40 // Call back fitvid when click load more button on buddypress 41 $( 'body.buddypress .activity .load-more a' ).on( 'click', function () { 42 $(document).ajaxStop(function() { 43 $( ".container" ).fitVids(); 44 }); 45 } ); 46 } 47 48 /* Sticky main navigation 49 ---------------------------------------------------------------*/ 50 PENCI.main_sticky = function () { 51 if ( $().sticky && ! $( "nav#navigation" ).hasClass( 'penci-disable-sticky-nav' ) ) { 52 var spaceTop = 0; 53 if ( $( 'body' ).hasClass( 'admin-bar' ) ) { 54 spaceTop = 32; 55 } 56 $( "nav#navigation" ).each( function () { 57 $( this ).sticky( { topSpacing: spaceTop } ); 58 } ); 59 } // sticky 60 } 61 62 /* Fix margin headline 63 ----------------------------------------------------------------*/ 64 PENCI.fixheadline = function () { 65 var $headline_title = $( '.penci-headline .headline-title' ); 66 if ( $headline_title.length ) { 67 var headline_w = $headline_title.outerWidth() + 70; 68 $('.penci-headline-posts' ).css( 'margin-left', headline_w + 'px' ); 69 $('.rtl .penci-headline-posts' ).css( 'margin-left', 0 + 'px' ); 70 $('.rtl .penci-headline-posts' ).css( 'margin-right', headline_w + 'px' ); 71 } 72 } 73 74 /* Homepage Featured Slider 75 ---------------------------------------------------------------*/ 76 PENCI.featured_slider = function () { 77 if ( $().owlCarousel ) { 78 $( '.featured-area .penci-owl-featured-area' ).each( function () { 79 var $this = $( this ), 80 $style = $this.data( 'style' ), 81 $auto = false, 82 $autotime = $this.data( 'autotime' ), 83 $speed = $this.data( 'speed' ), 84 $loop = $this.data('loop'), 85 $item = 1, 86 $nav = true, 87 $dots = false, 88 $rtl = false, 89 $items_desktop = 1, 90 $items_tablet = 1, 91 $items_tabsmall = 1; 92 93 if( $style === 'style-2' ) { 94 $item = 2; 95 } else if( $style === 'style-28' ) { 96 $loop = true; 97 } 98 99 if( $('html').attr('dir') === 'rtl' ) { 100 $rtl = true; 101 } 102 if ( $this.attr('data-auto') === 'true' ) { 103 $auto = true; 104 } 105 if ( $this.attr('data-nav') === 'false' ) { 106 $nav = false; 107 } 108 if ( $this.attr('data-dots') === 'true' ) { 109 $dots = true; 110 } 111 if ( $this.attr('data-item') ) { 112 $item = parseInt( $this.data('item') ); 113 } 114 if ( $this.attr('data-desktop') ) { 115 $items_desktop = parseInt( $this.data('desktop') ); 116 } 117 if ( $this.attr('data-tablet') ) { 118 $items_tablet = parseInt( $this.data('tablet') ); 119 } 120 if ( $this.attr('data-tabsmall') ) { 121 $items_tabsmall = parseInt( $this.data('tabsmall') ); 122 } 123 124 var owl_args = { 125 rtl : $rtl, 126 loop : $loop, 127 margin : 0, 128 items : $item, 129 navSpeed : $speed, 130 dotsSpeed : $speed, 131 nav : $nav, 132 slideBy : $item, 133 mouseDrag : false, 134 lazyLoad : true, 135 dots : $dots, 136 navText : ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 137 autoplay : $auto, 138 autoplayTimeout : $autotime, 139 autoplayHoverPause: true, 140 autoplaySpeed : $speed, 141 responsive : { 142 0 : { 143 items: 1 144 }, 145 480 : { 146 items : $items_tabsmall, 147 slideBy: $items_tabsmall 148 }, 149 768 : { 150 items : $items_tablet, 151 slideBy: $items_tablet 152 }, 153 1170: { 154 items : $items_desktop, 155 slideBy: $items_desktop 156 } 157 } 158 } 159 160 if( $style === 'style-2' ) { 161 owl_args['center'] = true; 162 owl_args['margin'] = 10; 163 owl_args['autoWidth'] = true; 164 } else if( $style === 'style-28' ) { 165 owl_args['margin'] = 4; 166 owl_args['items'] = 6; 167 owl_args['autoWidth'] = true; 168 } 169 170 $this.owlCarousel( owl_args ); 171 172 if( $style === 'style-2' || $style === 'style-5' || $style === 'style-28' || $style === 'style-29' ) { 173 $this.on( 'changed.owl.carousel', function ( event ) { 174 $this.find( '.penci-lazy' ).Lazy( { 175 effect: 'fadeIn', 176 effectTime: 300, 177 scrollDirection: 'both' 178 } ); 179 } ); 180 } 181 } ); 182 } // if owlcarousel
183 } 184 185 /* Owl Slider General 186 ---------------------------------------------------------------*/ 187 PENCI.owl_slider = function () { 188 if ( $().owlCarousel ) { 189 $( '.penci-owl-carousel-slider' ).each( function () { 190 var $this = $( this ), 191 $auto = true, 192 $dots = false, 193 $nav = true, 194 $loop = true, 195 $rtl = false, 196 $dataauto = $this.data( 'auto' ), 197 $items_desktop = 1, 198 $items_tablet = 1, 199 $items_tabsmall = 1, 200 $speed = 600, 201 $item = 1, 202 $autotime = 5000, 203 $datalazy = false; 204 205 if( $('html').attr('dir') === 'rtl' ) { 206 $rtl = true; 207 } 208 if ( $this.attr('data-dots') ) { 209 $dots = true; 210 } 211 if ( $this.attr('data-loop') ) { 212 $loop = false; 213 } 214 if ( $this.attr('data-nav') ) { 215 $nav = false; 216 } 217 if ( $this.attr('data-desktop') ) { 218 $items_desktop = parseInt( $this.data('desktop') ); 219 } 220 if ( $this.attr('data-tablet') ) { 221 $items_tablet = parseInt( $this.data('tablet') ); 222 } 223 if ( $this.attr('data-tabsmall') ) { 224 $items_tabsmall = parseInt( $this.data('tabsmall') ); 225 } 226 if ( $this.attr('data-speed') ) { 227 $speed = parseInt( $this.data('speed') ); 228 } 229 if ( $this.attr('data-autotime') ) { 230 $autotime = parseInt( $this.data('autotime') ); 231 } 232 if ( $this.attr('data-item') ) { 233 $item = parseInt( $this.data('item') ); 234 } 235 if ( $this.attr('data-lazy') ) { 236 $datalazy = true; 237 } 238 239 var owl_args = { 240 loop : $loop, 241 rtl : $rtl, 242 margin : 0, 243 items : $item, 244 slideBy : $item, 245 lazyLoad : $datalazy, 246 navSpeed : $speed, 247 dotsSpeed : $speed, 248 nav : $nav, 249 dots : $dots, 250 navText : ['<i class="fa fa-angle-left"></i>', '<i class="fa fa-angle-right"></i>'], 251 autoplay : $dataauto, 252 autoplayTimeout : $autotime, 253 autoHeight : true, 254 autoplayHoverPause: true, 255 autoplaySpeed : $speed, 256 responsive : { 257 0 : { 258 items : 1, 259 slideBy: 1 260 }, 261 480 : { 262 items : $items_tabsmall, 263 slideBy: $items_tabsmall 264 }, 265 768 : { 266 items : $items_tablet, 267 slideBy: $items_tablet 268 }, 269 1170: { 270 items : $items_desktop, 271 slideBy: $items_desktop 272 } 273 } 274 }; 275 276 if ( $this.hasClass( 'penci-headline-posts' ) ) { 277 owl_args['animateOut'] = 'slideOutUp'; 278 owl_args['animateIn'] = 'slideInUp'; 279 } 280 281 $this.owlCarousel( owl_args ); 282 283 $this.on('changed.owl.carousel', function(event) { 284 $this.find( '.penci-lazy' ).Lazy( { 285 effect: 'fadeIn', 286 effectTime: 300, 287 scrollDirection: 'both' 288 } ); 289 }); 290 } ); 291 } // if owlcarousel 292 } 293 294 /* Fitvids 295 ---------------------------------------------------------------*/ 296 PENCI.fitvids = function() { 297 // Target your .container, .wrapper, .post, etc. 298 $( ".container" ).fitVids(); 299 } 300 301 /* Sticky sidebar 302 ----------------------------------------------------------------*/ 303 PENCI.sticky_sidebar = function() { 304 if ( $().theiaStickySidebar ) { 305 var top_margin = 90; 306 if( $('body' ).hasClass('admin-bar') ) { 307 top_margin = 122; 308 } 309 $('#main.penci-main-sticky-sidebar, #sidebar.penci-sticky-sidebar' ).theiaStickySidebar({ 310 // settings 311 additionalMarginTop: top_margin 312 }); 313 } // if sticky 314 } 315 316 /* Mega menu 317 ----------------------------------------------------------------*/ 318 PENCI.mega_menu = function () { 319 $( '#navigation .penci-mega-child-categories a' ).mouseenter( function () { 320 if ( !$( this ).hasClass( 'cat-active' ) ) { 321 var $this = $( this ), 322 $row_active = $this.data( 'id' ), 323 $parentA = $this.parent().children( 'a' ), 324 $parent = $this.closest( '.penci-megamenu' ), 325 $rows = $this.closest( '.penci-megamenu' ).find( '.penci-mega-latest-posts' ).children( '.penci-mega-row' ); 326 $parentA.removeClass( 'cat-active' ); 327 $this.addClass( 'cat-active' ); 328 $rows.hide(); 329 $parent.find( '.' + $row_active ).fadeIn( '300' ).css( 'display', 'inline-block' ); 330 } 331 } ); 332 } 333 334 /* Mobile menu responsive 335 ----------------------------------------------------------------*/ 336 PENCI.mobile_menu = function () { 337 // Add indicator 338 $( '#sidebar-nav .menu li.menu-item-has-children > a' ).append( '<u class="indicator"><i class="fa fa-angle-down"></i></u>' ); 339 $( '#sidebar-nav .penci-mega-child-categories' ).closest('li.penci-mega-menu' ).children('a').append( '<u class="indicator"><i class="fa fa-angle-down"></i></u>' ); 340 341 // Toggle menu when click show/hide menu
342 $( '#navigation .button-menu-mobile' ).on( 'click', function () { 343 $( 'body' ).addClass( 'open-sidebar-nav' ); 344 } ); 345 346 // indicator click 347 $( '#sidebar-nav .menu li a .indicator' ).on( 'click', function ( e ) { 348 var $this = $( this ); 349 e.preventDefault(); 350 $this.children().toggleClass( 'fa-angle-up' ); 351 $this.parent().next().slideToggle( 'fast' ); 352 } ); 353 354 // Close sidebar nav 355 $( '#close-sidebar-nav' ).on( 'click', function () { 356 $( 'body' ).removeClass( 'open-sidebar-nav' ); 357 } ); 358 } 359 360 /* Light box 361 ----------------------------------------------------------------*/ 362 PENCI.lightbox = function () { 363 if ( $().magnificPopup) { 364 $( 'a[data-rel^="penci-gallery-image-content"], .penci-enable-lightbox .gallery-item a' ).magnificPopup( { 365 type : 'image', 366 closeOnContentClick: true, 367 closeBtnInside : false, 368 fixedContentPos : true, 369 image : { 370 verticalFit: true 371 }, 372 gallery : { 373 enabled: true 374 }, 375 zoom : { 376 enabled : true, 377 duration: 300 // don't foget to change the duration also in CSS 378 } 379 } ); 380 381 // Enable lightbox videos 382 $('.penci-other-layouts-lighbox').magnificPopup( { 383 type: 'iframe', 384 mainClass: 'mfp-fade', 385 fixedContentPos : true, 386 closeBtnInside : false, 387 closeOnContentClick: true 388 } ); 389 } // if magnificPopup exists 390 } 391 392 /* Masonry layout 393 ----------------------------------------------------------------*/ 394 PENCI.masonry = function() { 395 $(window).load(function() { 396 var $masonry_container = $( '.penci-masonry' ); 397 if ( $masonry_container.length ) { 398 $masonry_container.each( function () { 399 var $this = $( this ); 400 // initialize isotope 401 $this.isotope( { 402 itemSelector : '.item-masonry', 403 transitionDuration: '.55s', 404 layoutMode : 'masonry' 405 } ); 406 } ); 407 } 408 }); 409 } 410 411 /* Video Background 412 ----------------------------------------------------------------*/ 413 PENCI.video_background = function() { 414 var $penci_videobg = $( '#penci-featured-video-bg' ); 415 if ( $().mb_YTPlayer && $penci_videobg.length ) { 416 $(window ).load( function() { 417 $("#penci-featured-video-bg").mb_YTPlayer(); 418 setTimeout(function(){ 419 $('.featured-area').addClass( 'loaded-wait' ).append('<div class="overlay-video-click"></div>'); 420 $('.overlay-video-click').on( 'click', function () { 421 var $this = $(this); 422 if( !$this.hasClass( 'pause-video' ) ) { 423 $this.addClass('pause-video'); 424 jQuery('#penci-featured-video-bg').pauseYTP(); 425 } else { 426 $this.removeClass('pause-video'); 427 jQuery('#penci-featured-video-bg').playYTP(); 428 } 429 }); 430 }, 4000); 431 } ); 432 } 433 } 434 435 /* Portfolio 436 ----------------------------------------------------------------*/ 437 PENCI.portfolio = function () { 438 var $penci_portfolio = $( '.penci-portfolio' ); 439 if ( $().isotope && $penci_portfolio.length ) { 440 $( '.penci-portfolio' ).each( function () { 441 var $this = $( this ); 442 $( window ).load( function () { 443 $this.isotope( { 444 itemSelector : '.portfolio-item', 445 animationEngine : 'best-available', 446 animationOptions: { 447 duration: 250, 448 queue : false 449 } 450 } ); // isotope 451 452 $this.addClass( 'loaded' ); 453 454 $('.portfolio-item .inner-item-portfolio').each( function () { 455 var $this = $( this ); 456 $this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) { 457 $this.addClass( 'animated' ); 458 } ); // inview 459 } ); // each 460 461 } ); // load 462 463 // filter items when filter link is clicked 464 $this.parent().find( '.penci-portfolio-filter' ).find( 'li' ).on( 'click', function () { 465 $this.parent().find( '.penci-portfolio-filter' ).find( 'li' ).removeClass( 'active' ); 466 $( this ).addClass( 'active' ); 467 var selector = $( this ).find( "a" ).attr( 'data-filter' ); 468 $this.isotope( { filter: selector } ); 469 return false; 470 } ); 471 } ); // each .penci-portfolio 472 473 } // end if isotope & portfolio 474 } 475 476 /* Gallery 477 ----------------------------------------------------------------*/ 478 PENCI.gallery = function () { 479 var $justified_gallery = $( '.penci-post-gallery-container.justified' ); 480 var $masonry_gallery = $( '.penci-post-gallery-container.masonry' ); 481 if ( $().justifiedGallery && $justified_gallery.length ) { 482 $( '.penci-post-gallery-container.justified' ).each( function () { 483 var $this = $( this ); 484 $this.justifiedGallery( { 485 rowHeight: $this.data( 'height' ), 486 lastRow : 'nojustify', 487 margins : $this.data( 'margin' ), 488 randomize: false 489 } ); 490 } ); // each .penci-post-gallery-container 491 } 492 493 if ( $().isotope && $masonry_gallery.length ) { 494 495 $('.penci-post-gallery-container.masonry .item-gallery-masonry').each(function () { 496 var $this = $(this); 497 if ($this.attr('title')) { 498 var $title = $this.attr('title'); 499 $this.children().append('<div class="caption">' + $title + '</div>'); 500 } 501 }); 502 } 503 504 $(window).load(function() { 505 if ( $masonry_gallery.length ) { 506 $masonry_gallery.each( function () { 507 var $this = $( this ); 508 // initialize isotope 509 $this.isotope( { 510 itemSelector : '.item-gallery-masonry', 511 transitionDuration: '.55s', 512 layoutMode : 'masonry' 513 } ); 514 515 $this.addClass( 'loaded' ); 516 517 $('.penci-post-gallery-container.masonry .item-gallery-masonry').each( function () { 518 var $this = $( this ); 519 $this.one( 'inview', function ( event, isInView, visiblePartX, visiblePartY ) { 520 $this.addClass( 'animated' ); 521 } ); // inview 522 } ); // each 523 524 } ); 525 } 526 }); 527 } 528 529 530 /* Init functions 531 ---------------------------------------------------------------*/ 532 $(document).ready(function() { 533 PENCI.general(); 534 PENCI.main_sticky(); 535 PENCI.fixheadline(); 536 PENCI.featured_slider(); 537 PENCI.owl_slider(); 538 PENCI.fitvids(); 539 PENCI.sticky_sidebar(); 540 PENCI.mega_menu(); 541 PENCI.mobile_menu(); 542 PENCI.lightbox(); 543 PENCI.masonry(); 544 PENCI.video_background(); 545 PENCI.portfolio(); 546 PENCI.gallery(); 547 $(window ).resize( function(){ PENCI.sticky_sidebar(); } ); 548 }); 549 550})(jQuery); // EOF
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.