1/* start page builder */ 2(function($){ 3 "use strict"; 4 5 // Detect Mobile Device 6 var gdlr_core_mobile = false; 7 if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/BlackBerry/i) || 8 navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Windows Phone/i) ){ 9 gdlr_core_mobile = true; 10 }else{ 11 gdlr_core_mobile = false; 12 } 13 14 // Detect Screen 15 var gdlr_core_display = 'desktop'; 16 if( typeof(window.matchMedia) == 'function' ){ 17 $(window).on('resize themename-set-display gdlr-core-element-resize', function(){ 18 if( window.matchMedia('(max-width: 419px)').matches ){ 19 gdlr_core_display = 'mobile-portrait'; 20 }else if( window.matchMedia('(max-width: 767px)').matches ){ 21 gdlr_core_display = 'mobile-landscape' 22 }else if( window.matchMedia('(max-width: 959px)').matches ){ 23 gdlr_core_display = 'tablet' 24 }else{ 25 gdlr_core_display = 'desktop'; 26 } 27 }); 28 $(window).trigger('themename-set-display'); 29 }else{ 30 $(window).on('resize themename-set-display gdlr-core-element-resize', function(){ 31 if( $(window).innerWidth() <= 419 ){ 32 gdlr_core_display = 'mobile-portrait'; 33 }else if( $(window).innerWidth() <= 767 ){ 34 gdlr_core_display = 'mobile-landscape' 35 }else if( $(window).innerWidth() <= 959 ){ 36 gdlr_core_display = 'tablet' 37 }else{ 38 gdlr_core_display = 'desktop'; 39 } 40 }); 41 $(window).trigger('themename-set-display'); 42 } 43 44 // set cookie 45 function gdlr_core_set_cookie( cname, cvalue, expires ){ 46 if( typeof(expires) != 'undefined' ){ 47 if( expires == 0 ){ 48 expires = 86400; 49 } 50 51 var now = new Date(); 52 var new_time = now.getTime() + (parseInt(expires) * 1000); 53 now.setTime(new_time); 54 55 expires = now.toGMTString(); 56 } 57 58 document.cookie = cname + "=" + encodeURIComponent(cvalue) + "; expires=" + expires + "; path=/"; 59 } 60 61 // monitor swipe 62 $.fn.gdlr_core_monitor_swipe = function (settings) { 63 64 // default parameter 65 settings = $.extend( 66 { 67 mouseEvent: true, 68 swipeThreshold: 150, 69 allowedTime: 300 70 }, 71 settings 72 ); 73 74 var swipeArea = $( this ); 75 var startX = 0, startTime = 0; 76 var startEvent = settings.mouseEvent ? 'mousedown touchstart' : 'touchstart'; 77 var endEvent = settings.mouseEvent ? 'mouseup touchend' : 'touchend'; 78 79 swipeArea.on( 80 startEvent, 81 function (e) { 82 startX = e.clientX; 83 startTime = new Date().getTime(); 84 } 85 ); 86 swipeArea.on( 87 endEvent, 88 function (e) { 89 90 var swipeDistance = e.clientX - startX; 91 var elapsedTime = new Date().getTime() - startTime; 92 93 if (elapsedTime <= settings.allowedTime && Math.abs( swipeDistance ) > settings.swipeThreshold ) { 94 if (swipeDistance > 0 ) { 95 swipeArea.trigger( 'swiperight' ); 96 } else { 97 swipeArea.trigger( 'swipeleft' ); 98 } 99 } 100 } 101 ); 102 103 // prevent dragitem 104 if (settings.mouseEvent ) { 105 swipeArea.on( 106 'dragstart', 107 function (e) { 108 e.preventDefault(); 109 } 110 ); 111 } 112 113 } 114 115 // script for normal content 116 $.fn.gdlr_core_content_script = function( filter_elem, document_ready ){ 117 118 $(this).gdlr_core_fluid_video( filter_elem ); 119 120 // audio 121 if( !document_ready && typeof($.fn.mediaelementplayer) == 'function' ){ 122 var wpme_settings = { 123 "stretching": "responsive" 124 }; 125 if( typeof(_wpmejsSettings) !== 'undefined' ){ 126 wpme_settings.pluginPath = _wpmejsSettings.pluginPath; 127 } 128 129 $(this).find('audio, video').mediaelementplayer(wpme_settings); 130 } 131 132 return $(this); 133 } 134 135 // responsive video 136 $.fn.gdlr_core_fluid_video = function( filter_elem ){ 137 138 if( typeof(filter_elem) == 'undefined' ){ 139 var elem = $(this).find('iframe[src*="youtube"], iframe[src*="vimeo"]'); 140 }else{ 141 var elem = filter_elem.filter('iframe[src*="youtube"], iframe[src*="vimeo"]'); 142 } 143 144 elem.each(function(){ 145 146 // ignore if inside slider 147 if( $(this).closest('.ls-container, .master-slider').length <= 0 ){ 148 if( ($(this).is('embed') && $(this).parent('object').length) || $(this).parent('.gdlr-core-fluid-v
148ideo-wrapper').length ){ return; } 149 if( !$(this).attr('id') ){ $(this).attr('id', 'gdlr-video-' + Math.floor(Math.random()*999999)); } 150 151 if( $(this).attr('height') && $(this).attr('width') ){ 152 var ratio = parseInt($(this).attr('height')) / parseInt($(this).attr('width')); 153 }else{ 154 var ratio = $(this).height() / $(this).width(); 155 } 156 $(this).removeAttr('height').removeAttr('width'); 157 158 try{ 159 $(this).wrap('<div class="gdlr-core-fluid-video-wrapper"></div>').parent().css('padding-top', (ratio * 100)+"%"); 160 $(this).attr('src', $(this).attr('src')); 161 }catch(e){} 162 } 163 }); 164 165 // overlay 166 $('.gdlr-core-video-item-overlay').each(function(){ 167 168 var button = $(this); 169 var video = $(this).closest('.gdlr-core-video-item').find('iframe'); 170 171 // vimeo 172 if( video.attr('data-player-type') == 'vimeo' ){ 173 174 var player = $f(video[0]); 175 176 button.on('click', function(){ 177 $(this).css('pointer-events', 'none').fadeOut(500, function(e){ 178 $(this).remove(); 179 }); 180 181 video[0].src += "&autoplay=1"; 182 }); 183 184 }else if( video.attr('data-player-type') == 'youtube' ){ 185 186 button.on('click', function(){ 187 $(this).css('pointer-events', 'none').fadeOut(500, function(e){ 188 $(this).remove(); 189 }); 190 191 video[0].src += "&autoplay=1&mute=1"; 192 }); 193 194 } 195 }); 196 197 return $(this); 198 } 199 200 // ajax mejs 201 $.fn.gdlr_core_mejs_ajax = function(){ 202 if( typeof($.fn.mediaelementplayer) == 'function' ){ 203 204 var wpme_settings = {}; 205 if( typeof(_wpmejsSettings) !== 'undefined' ){ wpme_settings.pluginPath = _wpmejsSettings.pluginPath; } 206 $(this).find('audio, video').mediaelementplayer(wpme_settings); 207 208 } 209 } 210 211 // hover box 212 $.fn.gdlr_core_hover_box = function( filter_elem ){ 213 214 if( typeof(filter_elem) == 'undefined' ){ 215 var elem = $(this).find('.gdlr-core-hover-box .gdlr-core-hover-thumbnail'); 216 }else{ 217 var elem = filter_elem.filter('.gdlr-core-hover-box').find('.gdlr-core-hover-thumbnail'); 218 } 219 220 221 elem.each(function(){ 222 $(this).closest('.gdlr-core-hover-box').hover(function(){ 223 var ch1 = $(this).find('.gdlr-core-hover-thumbnail').children('img').eq(0); 224 var ch2 = $(this).find('.gdlr-core-hover-thumbnail').children('img').eq(1); 225 226 ch1.css('display', 'none'); 227 ch2.fadeIn(300); 228 }, function(){ 229 var ch1 = $(this).find('.gdlr-core-hover-thumbnail').children('img').eq(0); 230 var ch2 = $(this).find('.gdlr-core-hover-thumbnail').children('img').eq(1); 231 232 ch2.css('display', 'none'); 233 ch1.fadeIn(300); 234 }); 235 }); 236 237 } 238 239 // counter item 240 $.fn.gdlr_core_counter_item = function( filter_elem ){ 241 242 if( typeof(filter_elem) == 'undefined' ){ 243 var elem = $(this).find('.gdlr-core-counter-item-count[data-counter-start][data-counter-end]'); 244 }else{ 245 var elem = filter_elem.filter('.gdlr-core-counter-item-count[data-counter-start][data-counter-end]'); 246 } 247 248 elem.each(function(){ 249 var counter_item = $(this); 250 var start_num = parseInt($(this).attr('data-counter-start')); 251 var end_num = parseInt($(this).attr('data-counter-end')); 252 var duration_time = ($(this).attr('data-duration'))? parseInt($(this).attr('data-duration')): 4000; 253 254 if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > counter_item.offset().top ){ 255 $({ counter_num: start_num }).animate({ counter_num: end_num }, { duration: duration_time, easing: 'easeOutExpo', 256 step: function(){ 257 if( this.counter_num > 0.3 ){ 258 counter_item.html( Math.round(this.counter_num) ); 259 }else{ 260 counter_item.html( 0 ); 261 } 262 263 } 264 }); 265 }else{ 266 $(window).on('scroll pb-scroll', function( e ){ 267 if( $(this).scrollTop() + $(window).height() > counter_item.offset().top ){ 268 $({ counter_num: start_num }).animate({ counter_num: end_num }, { duration: duration_time, easing: 'easeOutQuart', 269 step: function(){ 270 if( this.counter_num > 0.3 ){ 271 counter_item.html( Math.ceil(this.counter_num) ); 272 }else{ 273 counter_item.html( 0 ); 274 } 275 } 276 });
277 278 $(this).unbind('scroll pb-scroll', e.handleObj.handler, e); 279 } 280 }); 281 } 282 }); 283 } 284 285 // typed animation item 286 $.fn.gdlr_core_typed_animation = function( filter_elem ){ 287 288 if( typeof(filter_elem) == 'undefined' ){ 289 var elem = $(this).find('.gdlr-core-type-animation-item-animated[data-animation-text]'); 290 }else{ 291 var elem = filter_elem.filter('.gdlr-core-type-animation-item-animated[data-animation-text]'); 292 } 293 294 elem.each(function(){ 295 296 var animation_text = JSON.parse($(this).attr('data-animation-text')); 297 298 if( typeof($.fn.typed) == 'function' && animation_text && animation_text.length > 0 ){ 299 $(this).typed({ 300 strings: animation_text, 301 typeSpeed: 50, 302 loop: true 303 }); 304 } 305 }); 306 } 307 308 // countdown item 309 $.fn.gdlr_core_countdown_item = function( filter_elem ){ 310 311 if( typeof(filter_elem) == 'undefined' ){ 312 var elem = $(this).find('.gdlr-core-countdown-wrap'); 313 }else{ 314 var elem = filter_elem.filter('.gdlr-core-countdown-wrap'); 315 } 316 317 elem.each(function(){ 318 var day_field = $(this).find('.gdlr-core-day'); 319 var day = parseInt(day_field.text()); 320 321 var hrs_field = $(this).find('.gdlr-core-hrs'); 322 var hrs = parseInt(hrs_field.text()); 323 324 var min_field = $(this).find('.gdlr-core-min'); 325 var min = parseInt(min_field.text()); 326 327 var sec_field = $(this).find('.gdlr-core-sec'); 328 var sec = parseInt(sec_field.text()); 329 330 $(window).on('load', function(){ 331 sec_field.text('00'); 332 sec_field.css('width', sec_field.width()); 333 sec_field.text(sec); 334 }); 335 336 var i = setInterval(function(){ 337 if( sec > 0 ){ 338 sec--; 339 }else{ 340 sec = 59; 341 if( min > 0 ){ 342 min--; 343 }else{ 344 min = 59; 345 if( hrs > 0 ){ 346 hrs--; 347 }else{ 348 hrs = 24; 349 if( day > 0 ){ 350 day--; 351 }else{ 352 day = 0; 353 hrs = 0; 354 min = 0; 355 sec = 0; 356 clearInterval(i); 357 } 358 day_field.text(day); 359 } 360 hrs_field.text(hrs); 361 } 362 min_field.text(min); 363 } 364 sec_field.text(sec); 365 }, 1000); 366 }); 367 } 368 369 // accordion 370 $.fn.gdlr_core_accordion = function( filter_elem ){ 371 372 if( typeof(filter_elem) == 'undefined' ){ 373 var elem_title = $(this).find('.gdlr-core-accordion-item-title'); 374 var elem_icon = $(this).find('.gdlr-core-accordion-item-icon'); 375 }else{ 376 var elem_title = filter_elem.filter('.gdlr-core-accordion-item-title'); 377 var elem_icon = filter_elem.filter('.gdlr-core-accordion-item-icon'); 378 } 379 380 elem_title.click(function(){ 381 $(this).siblings('.gdlr-core-accordion-item-content').slideDown(200); 382 383 var item_tab = $(this).closest('.gdlr-core-accordion-item-tab'); 384 if( item_tab.hasClass('gdlr-core-active') ){ 385 if( item_tab.closest('.gdlr-core-accordion-item').hasClass('gdlr-core-allow-close-all') ){ 386 item_tab.removeClass('gdlr-core-active') 387 .find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200); 388 } 389 }else{ 390 item_tab.addClass('gdlr-core-active') 391 .siblings('.gdlr-core-active').removeClass('gdlr-core-active') 392 .find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200); 393 } 394 }); 395 elem_icon.click(function(){ 396 if( $(this).closest('.gdlr-core-accordion-item-title').length ){ return; } 397 398 $(this).siblings('.gdlr-core-accordion-item-content-wrapper').children('.gdlr-core-accordion-item-content').slideDown(200); 399 400 var item_tab = $(this).closest('.gdlr-core-accordion-item-tab'); 401 if( item_tab.hasClass('gdlr-core-active') ){ 402 if( item_tab.closest('.gdlr-core-accordion-item').hasClass('gdlr-core-allow-close-all') ){ 403 item_tab.removeClass('gdlr-core-active') 404 .find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200); 405 } 406 }else{ 407 item_tab.addClass('gdlr-core-active') 408 .siblings('.gdlr-core-active').removeClass('gdlr-core-active') 409 .find('.gdlr-core-accordion-item-content').css({display: 'block'}).slideUp(200); 410 } 411 }); 412 } 413 414 // toggle_box 415 $.fn.gdlr_core_toggle_box = function( filter_elem ){ 416 417 if( typeof(filter_elem) == 'undefined' ){ 418 var elem_title = $(this).find('.gdlr-core-toggle-box-item-title'); 419 var elem_icon = $(this).find('.gdlr-core-toggle-box-item-icon'); 420 }else{ 421 var elem_title = filter_elem.filter('.gdlr-core-toggle-box-item-title'); 422 var elem_icon = filter_elem.filter('.gdlr-core-toggle-box-item-icon'); 423 } 424 425 elem_title.click(function(){ 426 var toggle_parent = $(this).closest('.gdlr-core-toggle-box-item-tab'); 427 if( toggle_parent.hasClass('gdlr-core-active') ){ 428 429 toggle_parent.removeClass('gdlr-core-active'); 430 $(this).siblings('.gdlr-core-toggle-box-item-content').css({display: 'block'}).slideUp(200); 431 432 }else{ 433 434 toggle_parent.addClass('gdlr-core-active'); 435 $(this).siblings('.gdlr-core-toggle-box-item-content').css({display: 'none'}).slideDown(200); 436 } 437 }); 438 elem_icon.click(function(){ 439 if( $(this).closest('.gdlr-core-toggle-box-item-title').length ){ return; } 440 441 var toggle_parent = $(this).closest('.gdlr-core-toggle-box-item-tab'); 442 if( toggle_parent.hasClass('gdlr-core-active') ){ 443 toggle_parent.removeClass('gdlr-core-active'); 444 $(this).siblings('.gdlr-core-toggle-box-item-content-wrapper').children('.gdlr-core-toggle-box-item-content').css({display: 'block'}).slideUp(200); 445 446 }else{ 447 toggle_parent.addClass('gdlr-core-active'); 448 $(this).siblings('.gdlr-core-toggle-box-item-content-wrapper').children('.gdlr-core-toggle-box-item-content').css({display: 'none'}).slideDown(200); 449 } 450 }); 451 } 452 453 // alert box 454 $.fn.gdlr_core_alert_box_item = function( filter_elem ){ 455 456 if( typeof(filter_elem) == 'undefined' ){ 457 var elem = $(this).find('.gdlr-core-alert-box-remove'); 458 }else{ 459 var elem = filter_elem.filter('.gdlr-core-alert-box-remove'); 460 } 461 462 elem.click(function(){ 463 $(this).closest('.gdlr-core-alert-box-item').slideUp(400, 'easeOutQuart', function(){ 464 $(this).remove(); 465 }); 466 }); 467 } 468 469 // particle background 470 $.fn.gdlr_core_particle_background = function( filter_elem ){ 471 472 if( typeof(filter_elem) == 'undefined' ){ 473 var elem = $(this).find('.gdlr-core-particle-bg'); 474 }else{ 475 var elem = filter_elem.filter('.gdlr-core-particle-bg'); 476 } 477 478 elem.each(function(){ 479 if( typeof(window.gdlr_particle_bg_id) == 'undefined' ){ 480 window.gdlr_particle_bg_id = 1; 481 }else{ 482 window.gdlr_particle_bg_id++; 483 } 484 485 var item_id = 'gdlr-core-particle' + window.gdlr_particle_bg_id; 486 $(this).attr('id', item_id); 487 488 particlesJS(item_id, { 489 "particles": { 490 "number": { 491 "value": 40, 492 "density": {"enable": true,"value_area": 1500} 493 }, 494 "color": {"value": "#ffffff"}, 495 "shape": { 496 "type": "circle", 497 "stroke": {"width": 0,"color": "#000000"}, 498 "polygon": {"nb_sides": 5}, 499 "image": {"src": "img/github.svg","width": 100,"height": 100} 500 }, 501 "opacity": { 502 "value": 0.8, 503 "random": false, 504 "anim": {"enable": false,"speed": 0.6,"opacity_min": 0.1,"sync": false} 505 }, 506 "size": { 507 "value": 2, 508 "random": true, 509 "anim": {"enable": false,"speed": 80,"size_min": 0.1,"sync": false} 510 }, 511 "line_linked": {"enable": true,"distance": 300,"color": "#ffffff","opacity": 0.4,"width": 2}, 512 "move": { 513 "enable": true, 514 "speed": 12, 515 "direction": "none", 516 "random": false, 517 "straight": false, 518 "out_mode": "out", 519 "bounce": false, 520 "attract": {"enable": false,"rotateX": 600,"rotateY": 1200} 521 } 522 }, 523 "interactivity": { 524 "detect_on": "canvas", 525 "events": { 526 "onhover": {"enable": false,"mode": "repulse"}, 527 "onclick": {"enable": false,"mode": "push"}, 528 "resize": true 529 }, 530 "modes": { 531 "grab": {"distance": 800,"line_linked": {"opacity": 1}}, 532 "bubble": {"distance": 800,"size": 80,"duration": 2,"opacity": 0.8,"
532speed": 3}, 533 "repulse": {"distance": 400,"duration": 0.4}, 534 "push": {"particles_nb": 4}, 535 "remove": {"particles_nb": 2} 536 } 537 }, 538 "retina_detect": true 539 }); 540 }); 541 542 return $(this); 543 } 544 545 // parallax background 546 $.fn.gdlr_core_parallax_background = function( filter_elem ){ 547 548 if( typeof(filter_elem) == 'undefined' ){ 549 var elem = $(this).find('.gdlr-core-parallax'); 550 }else{ 551 var elem = filter_elem.filter('.gdlr-core-parallax'); 552 } 553 554 elem.each(function(){ 555 new gdlr_core_parallax($(this)); 556 }); 557 558 return $(this); 559 } 560 561 var gdlr_core_parallax = function(t){ 562 563 this.wrapper_bg = t; 564 this.wrapper = t.parent(); // background-wrap 565 566 this.parallax_speed = parseFloat(t.attr('data-parallax-speed')); 567 568 this.init(); 569 } 570 gdlr_core_parallax.prototype = { 571 572 init: function(){ 573 574 var t = this; 575 576 // scroll event 577 if( t.parallax_speed != 0 ){ 578 t.set_extra_height(); 579 t.set_background_position(t); 580 $(window).on('load resize gdlr-core-element-resize', function(){ 581 t.set_extra_height($(this)); 582 t.set_background_position(t); 583 }); 584 585 $(window).on('scroll pb-scroll', function(){ 586 t.set_background_position(t); 587 }); 588 } 589 590 if( gdlr_core_mobile ){ 591 t.wrapper_bg.children('[data-background-type="video"]').remove(); 592 593 if( t.wrapper_bg.attr('data-video-fallback') ){ 594 t.wrapper_bg.css('background-image', 'url(' + t.wrapper_bg.attr('data-video-fallback') + ')') 595 } 596 }else{ 597 t.wrapper_bg.children('[data-background-type="video"]').each(function(){ 598 if( t.parallax_speed == 0 ){ 599 t.set_extra_height(); 600 t.set_background_position(t); 601 $(window).on('load resize gdlr-core-element-resize', function(){ 602 t.set_extra_height($(this)); 603 t.set_background_position(t); 604 }); 605 } 606 607 // script for muting the vimeo/youtube player 608 $(this).find('iframe').each(function(){ 609 if( $(this).attr('data-player-type') == 'vimeo' ){ 610 var player = $f($(this)[0]); 611 612 player.addEvent('ready', function() { 613 player.api('setVolume', 0); 614 }); 615 }else if( $(this).attr('data-player-type') == 'youtube' ){ 616 617 // assign the script 618 if( $('body').children('#gdlr-core-youtube-api').length == 0 ){ 619 $('body').append('<script src="https://www.youtube.com/iframe_api" id="gdlr-core-youtube-api" ></script>'); 620 } 621 622 // store to global variable 623 if( typeof(window.gdlr_core_ytb) == 'undefined' ){ 624 window.gdlr_core_ytb = [$(this)[0]]; 625 }else{ 626 window.gdlr_core_ytb.push($(this)[0]); 627 } 628 629 // script loading action 630 window.onYouTubeIframeAPIReady = function(){ 631 632 if( typeof(gdlr_core_ytb) != 'undefined' ){ 633 for( var key in window.gdlr_core_ytb ){ 634 new YT.Player(gdlr_core_ytb[key],{ 635 events: { 636 'onReady': function(e){ 637 e.target.mute(); 638 e.target.playVideo(); 639 } 640 } 641 }); 642 } 643 } 644 } 645 } 646 }); 647 }); 648 } // else gdlr_core_mobile 649 650 }, // init 651 652 set_extra_height: function(){ 653 654 var t = this; 655 656 var new_height = t.wrapper.outerHeight(); 657 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){ 658 t.wrapper_bg.css({'transform': ''}); 659 }else{ 660 if( t.parallax_speed > 0){ 661 new_height += (($(window).height() - t.wrapper.outerHeight()) * t.parallax_speed); 662 }else if( t.parallax_speed < 0){ 663 new_height += (($(window).height() + t.wrapper.outerHeight()) * Math.abs(t.parallax_speed)); 664 } 665 } 666 t.wrapper_bg.css({height: new_height}); 667 668 // set video height 669 var ratio = parseInt(gdlr_core_pbf.video.width) / parseInt(gdlr_core_pbf.video.height); 670 t.wrapper_bg.children('[data-background-type="video"]').each(function(){ 671 if( (t.wrapper_bg.width() / t.wrapper_bg.height()) > ratio ){ 672 var v_height = t.wrapper_bg.width() / ratio; 673 var v_margin = (t.wrapper_bg.height() - v_height) / 2; 674 $(this).css({width: t.wrapper_bg.width(), height: v_height, 'margin-left': 0, 'margin-top': v_margin}); 675 }else{ 676 var v_width = t.wrapper_bg.height() * ratio; 677 var v_margin = (t.wrapper_bg.width() - v_width) / 2; 678 $(this).css({width: v_width, height: t.wrapper_bg.height(), 'margin-left': v_margin, 'margin-top': 0}); 679 } 680 }); 681 682 }, // set_extra_height 683 684 set_background_position: function( t ){ 685 686 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ) return; 687 688 var wrapper_top = t.wrapper.offset().top; 689 var scroll_pos = $(window).scrollTop(); 690 691 if( scroll_pos + $(window).height() > wrapper_top && 692 scroll_pos < wrapper_top + t.wrapper.outerHeight() ){ 693 694 if( t.parallax_speed > 0 ){ 695 t.wrapper_bg.css({'transform': 'translate(0px, ' + (($(window).scrollTop() - wrapper_top) * t.parallax_speed) + 'px)'}); 696 }else if( t.parallax_speed < 0 ){ 697 t.wrapper_bg.css({'transform': 'translate(0px, ' + (($(window).scrollTop() + $(window).height() - wrapper_top) * t.parallax_speed) + 'px)'}); 698 } 699 } 700 } 701 }; // gdlr_core_parallax 702 703 // ux animation 704 var gdlr_core_ux = function( container, filter_elem ){ 705 706 if( typeof(filter_elem) == 'undefined' ){ 707 this.elem = container.find('[data-gdlr-animation]'); 708 }else{ 709 this.elem = filter_elem.filter('[data-gdlr-animation]'); 710 this.preload = filter_elem.filter('.gdlr-core-page-preload'); 711 } 712 713 this.ux_items = []; 714 this.ux_item_length = 0; 715 716 this.init(); 717 718 // for 3d effects 719 if( !gdlr_core_mobile && gdlr_core_display == 'desktop' ){ 720 if( typeof(filter_elem) == 'undefined' ){ 721 var elem_3d = container.find('.gdlr-core-effect-3d'); 722 }else{ 723 var elem_3d = filter_elem.filter('.gdlr-core-effect-3d'); 724 } 725 726 elem_3d.each(function(){ 727 var plain = $(this); 728 var max_degree = $(this).attr('data-max-deg'); 729 if( max_degree == null ){ 730 max_degree = 30; 731 } 732 733 $(this).parent().on('mousemove', function(e){
734 if( !gdlr_core_display == 'desktop' ) return; 735 736 var posX = e.pageX - $(this).offset().left; 737 var posY = e.pageY - $(this).offset().top; 738 var half_width = $(this).outerWidth()/2; 739 var half_height = $(this).outerHeight()/2; 740 var ax = max_degree * -(half_width - posX) / half_width; 741 var ay = max_degree * (half_height - posY) / half_height; 742 743 plain.removeClass('gdlr-core-animate-transform'); 744 plain.css({'transform': 'rotateY(' + ax + 'deg) rotateX(' + ay + 'deg)'}); 745 }); 746 $(this).parent().on('mouseleave', function(e){ 747 plain.addClass('gdlr-core-animate-transform'); 748 plain.css({'transform': 'rotateY(0deg) rotateX(0deg)'}); 749 setTimeout(function (){ 750 plain.removeClass('gdlr-core-animate-transform'); 751 }, 200); 752 }); 753 }); 754 } 755 756 } // gdlr_core_ux 757 gdlr_core_ux.prototype = { 758 759 init: function(){ 760 761 var t = this; 762 763 t.ux_item_length = t.elem.each(function(){ 764 var ux_item = $(this); 765 var ux_item_offset = 0.8; 766 if( $(this).attr('data-gdlr-animation-offset') ){ 767 ux_item_offset = parseFloat($(this).attr('data-gdlr-animation-offset')); 768 } 769 770 // check item at the first time the page is loaded 771 if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > ux_item.offset().top ){ 772 t.ux_items.push(ux_item); 773 774 // check the item on scroll event 775 }else{ 776 $(window).on('scroll pb-scroll', function(e){ 777 if( $(window).scrollTop() + ($(window).height() * ux_item_offset) > ux_item.offset().top ){ 778 t.ux_items.push(ux_item); 779 $(window).unbind('scroll', e.handleObj.handler, e); 780 } 781 }); 782 } 783 }).length; 784 785 /* 786 if( typeof(t.preload) != 'undefined' && t.preload.length ){ 787 $(window).on('load', function(){ 788 var preload_time = t.preload.attr('data-animation-time'); 789 if( !preload_time ){ preload_time = 0; } 790 791 setTimeout(function(){ 792 t.animate(); 793 }, preload_time); 794 }); 795 }else{ 796 */ 797 t.animate(); 798 // } 799 800 }, 801 802 animate: function(){ 803 804 var t = this; 805 806 // run the ux in order with delay 807 var ux_interval = setInterval(function(){ 808 809 while( t.ux_items.length > 0 ){ 810 811 // animate the ux item 812 var ux_animate = t.ux_items.shift(); 813 var animation_duration = '600ms'; 814 if( ux_animate.attr('data-gdlr-animation-duration') ){ 815 animation_duration = ux_animate.attr('data-gdlr-animation-duration'); 816 } 817 818 ux_animate.css({ 'animation-duration': animation_duration }); 819 ux_animate.addClass(ux_animate.attr('data-gdlr-animation')); 820 821 // remove selector 822 setTimeout(function(){ 823 ux_animate.css({ 'animation-duration': '' }) 824 .removeClass(ux_animate.attr('data-gdlr-animation')) 825 .removeAttr('data-gdlr-animation'); 826 }, parseInt(animation_duration)); 827 828 t.ux_item_length--; 829 830 // if item is inside the screen break while loop 831 if( $(window).scrollTop() < ux_animate.offset().top + ux_animate.outerHeight() ){ 832 break; 833 } 834 } 835 836 if( t.ux_item_length <= 0 ){ 837 clearInterval(ux_interval); 838 } 839 }, 200); 840 841 } 842 843 }; // gdlr_core_ux.prototype 844 $.fn.gdlr_core_ux = function( filter_elem ){ 845 new gdlr_core_ux( $(this), filter_elem ); 846 847 return $(this); 848 } 849 850 // skill bar 851 $.fn.gdlr_core_skill_bar = function( filter_elem ){ 852 853 if( typeof(filter_elem) == 'undefined' ){ 854 var elem = $(this).find('.gdlr-core-skill-bar-filled'); 855 }else{ 856 var elem = filter_elem.filter('.gdlr-core-skill-bar-filled'); 857 } 858 859 elem.each(function(){ 860 var t = $(this); 861 862 if( (gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') || $(window).scrollTop() + $(window).height() > t.offset().top ){ 863 t.animate({width: parseInt(t.attr('data-width')) + '%'}, {duration: 1200, easing: 'easeOutQuart'}).addClass('gdlr-core-animate'); 864 }else{ 865 $(window).on('scroll pb-scroll', function(e){
866 if( $(window).scrollTop() + $(window).height() > t.offset().top ){ 867 t.animate({width: parseInt(t.attr('data-width')) + '%'}, {duration: 1200, easing: 'easeOutQuart'}).addClass('gdlr-core-animate'); 868 $(window).unbind('scroll pb-scroll', e.handleObj.handler, e); 869 } 870 }); 871 } 872 }); 873 } 874 875 // divider width 876 $.fn.gdlr_core_divider = function( filter_elem ){ 877 878 if( typeof(filter_elem) == 'undefined' ){ 879 var elem = $(this).find('.gdlr-core-divider-item-with-icon-inner'); 880 }else{ 881 var elem = filter_elem.filter('.gdlr-core-divider-item-with-icon-inner'); 882 } 883 884 elem.each(function(){ 885 var divider_elem = $(this); 886 var icon_width = divider_elem.children('i, img').outerWidth(); 887 var divider_width = (divider_elem.width() - icon_width) / 2; 888 $(this).children('.gdlr-core-divider-line').css({ width: divider_width }).each(function(){ 889 $(this).css('margin-top', -$(this).outerHeight()/2); 890 }); 891 892 $(window).on('resize gdlr-core-element-resize', function(){ 893 icon_width = divider_elem.children('i, img').outerWidth(); 894 divider_width = (divider_elem.width() - icon_width) / 2; 895 divider_elem.children('.gdlr-core-divider-line').css({ width: divider_width }).each(function(){ 896 $(this).css('margin-top', -$(this).outerHeight()/2); 897 }); 898 }); 899 }); 900 901 } 902 903 window.gdlr_core_sidebar_wrapper = function( container, filter_elem ){ 904 905 if( typeof(filter_elem) == 'undefined' ){ 906 this.elem = container.find('.gdlr-core-page-builder-wrapper-sidebar-container, .gdlr-core-pbf-sidebar-container'); 907 }else{ 908 this.elem = filter_elem.filter('.gdlr-core-page-builder-wrapper-sidebar-container, .gdlr-core-pbf-sidebar-container'); 909 } 910 911 this.init(); 912 913 } 914 gdlr_core_sidebar_wrapper.prototype = { 915 916 init: function(){ 917 918 var t = this; 919 920 // if no background, don't sync height 921 var sync_height = false; 922 t.elem.each(function(){ 923 if( $(this).children().children('.gdlr-core-pbf-background-wrap').length ){ 924 sync_height = true; 925 } 926 }); 927 928 // sync the height 929 if( sync_height ){ 930 t.set_height(); 931 $(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); }); 932 } 933 }, 934 935 set_height: function(){ 936 937 var t = this; 938 939 t.elem.each(function(){ 940 941 var sidebar_elem = $(this).find('.gdlr-core-pbf-sidebar-padding'); 942 sidebar_elem.css('min-height', ''); 943 944 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ) return; 945 946 // determine max height 947 var max_height = 0; 948 sidebar_elem.each(function(){ 949 if( $(this).outerHeight() > max_height ){ 950 max_height = $(this).outerHeight(); 951 } 952 }); 953 954 // set the height 955 sidebar_elem.css('min-height', max_height); 956 957 }); 958 959 } 960 961 }; 962 963 // title divider width 964 $.fn.gdlr_core_title_divider = function( filter_elem ){ 965 966 if( typeof(filter_elem) == 'undefined' ){ 967 var elem = $(this).find('.gdlr-core-title-item-title-wrap.gdlr-core-with-divider'); 968 }else{ 969 var elem = filter_elem.filter('.gdlr-core-title-item-title-wrap.gdlr-core-with-divider'); 970 } 971 972 elem.each(function(){ 973 974 var t = $(this); 975 var divider = t.children('.gdlr-core-title-item-divider'); 976 var divider_num = t.children('.gdlr-core-title-item-divider').length; 977 divider_num = (divider_num)? divider_num: 1; 978 979 var title_width = t.children('.gdlr-core-title-item-title').outerWidth(true); 980 var divider_width = (t.width() - title_width) / divider_num; 981 if( t.children('.gdlr-core-title-item-link').length ){ 982 var right_pos = t.children('.gdlr-core-title-item-link').outerWidth() + 20; 983 divider_width = divider_width - right_pos; 984 } 985 986 // for right divider with link text 987 if( t.children('.gdlr-core-title-item-link').length ){ 988 divider.css({ width: divider_width, right: right_pos }); 989 }else{ 990 divider.css({ width: divider_width }); 991 } 992 993 $(window).on('resize gdlr-core-element-resize', function(){ 994 title_width = t.children('.gdlr-core-title-item-title').outerWidth(true); 995 divider_width = (t.width() - title_width) / divider_num; 996 if( t.children('.gdlr-core-title-item-link').length ){ 997 right_pos = t.children('.gdlr-core-title-item-link').outerWidth() + 20; 998 divider_width = divider_width - right_pos; 999 } 1000 1001 // for right divider with link text 1002 if( t.children('.gdlr-core-title-item-link').length ){ 1003 divider.css({ width: divider_width, right: right_pos }); 1004 }else{ 1005 divider.css({ width: divider_width }); 1006 } 1007 }); 1008 }); 1009 1010 if( typeof(filter_elem) == 'undefined' ){ 1011 var elem2 = $(this).find('.gdlr-core-title-item-title-wrap.gdlr-core-with-link-text'); 1012 }else{ 1013 var elem2 = filter_elem.filter('.gdlr-core-title-item-title-wrap.gdlr-core-with-link-text'); 1014 } 1015 elem2.each(function(){ 1016 var t = $(this); 1017 var title_width = t.children('.gdlr-core-title-item-title').outerWidth(true); 1018 var right_pos = t.children('.gdlr-core-title-item-link').outerWidth(); 1019 1020 if( t.width() < title_width + right_pos ){ 1021 t.children('.gdlr-core-title-item-link').addClass('gdlr-core-overflow'); 1022 }else{ 1023 t.children('.gdlr-core-title-item-link').removeClass('gdlr-core-overflow'); 1024 } 1025 1026 $(window).on('resize gdlr-core-element-resize', function(){ 1027 if( t.width() < title_width + right_pos ){ 1028 t.children('.gdlr-core-title-item-link').addClass('gdlr-core-overflow'); 1029 }else{ 1030 t.children('.gdlr-core-title-item-link').removeClass('gdlr-core-overflow'); 1031 } 1032 }); 1033 1034 }); 1035 1036 } 1037 1038 $.fn.gdlr_core_flipbox = function( filter_elem ){ 1039 if(typeof($.fn.flip) == 'function'){ 1040 1041 if( typeof(filter_elem) == 'undefined' ){ 1042 var elem = $(this).find('.gdlr-core-flipbox'); 1043 }else{ 1044 var elem = filter_elem.filter('.gdlr-core-flipbox'); 1045 } 1046 1047 elem.each(function(){ 1048 var flipbox_obj = $(this).flip({ 1049 axis: 'y', 1050 trigger: 'hover', 1051 autoSize: false, 1052 front: '.gdlr-core-flipbox-front', 1053 back: '.gdlr-core-flipbox-back' 1054 }); 1055 1056 $(this).find('.gdlr-core-flipbox-back a').click(function(){ 1057 if( flipbox_obj.data('flip-model') ){ 1058 flipbox_obj.data('flip-model').unflip(); 1059 } 1060 }); 1061 1062 $(this).addClass('gdlr-core-after-init'); 1063 }); 1064 } 1065 1066 return $(this); 1067 } 1068 1069 // marquee 1070 $.fn.gdlr_core_marquee = function( filter_elem ){ 1071 if( typeof(filter_elem) == 'undefined' ){ 1072 var elem = $(this).find('.gdlr-core-marquee'); 1073 }else{ 1074 var elem = filter_elem.filter('.gdlr-core-marquee'); 1075 } 1076 1077 elem.each(function(){ 1078 var speed = $(this).attr('data-speed')? parseFloat($(this).attr('data-speed')): 10000; 1079 var direction = $(this).attr('data-direction')? parseFloat($(this).attr('data-direction')): 'left'; 1080 1081 $(this).marquee({ 1082 //time in milliseconds before the marquee will start animating 1083 delayBeforeStart: 0, 1084 //speed in milliseconds of the marquee 1085 duration: speed, 1086 //gap in pixels between the tickers 1087 gap: 50, 1088 //'left' or 'right' 1089 direction: direction, 1090 //true or false - should the marquee be duplicated to show an effect of continues flow 1091 duplicated: true, 1092 // the marquee is visible initially positioned next to the border towards it will be moving 1093 startVisible: true 1094 }); 1095 }); 1096 1097 return $(this); 1098 } 1099 1100 // pie chart
1101 function gdlr_core_skill_circle_height(t){ 1102 t.children('.gdlr-core-skill-circle-content').each(function(){ 1103 $(this).css({'margin-top': -$(this).outerHeight()/2}); 1104 }); 1105 t.css({'max-width': t.parent().width(), 'max-height': t.parent().width()}); 1106 } 1107 $.fn.gdlr_core_pie_chart = function(){ 1108 if(typeof($.fn.easyPieChart) == 'function'){ 1109 $(this).easyPieChart({ 1110 animate: parseInt($(this).attr('data-duration')), 1111 lineWidth: parseInt($(this).attr('data-line-width')), 1112 size: parseInt($(this).attr('data-width')), 1113 barColor: $(this).attr('data-filled-color'), 1114 trackColor: $(this).attr('data-filled-background'), 1115 scaleColor: false, 1116 lineCap: 'square' 1117 }); 1118 } 1119 } 1120 $.fn.gdlr_core_skill_circle = function( filter_elem ){ 1121 1122 if( typeof(filter_elem) == 'undefined' ){ 1123 var elem = $(this).find('.gdlr-core-skill-circle'); 1124 }else{ 1125 var elem = filter_elem.filter('.gdlr-core-skill-circle'); 1126 } 1127 1128 elem.each(function(){ 1129 var t = $(this); 1130 1131 // for responsive 1132 gdlr_core_skill_circle_height(t); 1133 $(window).on('resize gdlr-core-element-resize', function(){ gdlr_core_skill_circle_height(t); }); 1134 1135 // scroll action 1136 if( $(window).scrollTop() + $(window).height() > t.offset().top ){ 1137 t.gdlr_core_pie_chart(); 1138 }else{ 1139 $(window).on('scroll pb-scroll', function(e){ 1140 if( $(window).scrollTop() + $(window).height() > t.offset().top ){ 1141 t.gdlr_core_pie_chart(); 1142 $(window).unbind('scroll pb-scroll', e.handleObj.handler, e); 1143 } 1144 }); 1145 } 1146 }); 1147 } 1148 1149 // chart.js 1150 $.fn.gdlr_core_chart_js = function( filter_elem ){ 1151 1152 if( typeof(filter_elem) == 'undefined' ){ 1153 var elem = $(this).find('.gdlr-core-chart-js'); 1154 }else{ 1155 var elem = filter_elem.filter('.gdlr-core-chart-js'); 1156 } 1157 1158 if( typeof(window.gdlr_core_chart_js_id) == 'undefined' ){ 1159 window.gdlr_core_chart_js_id = 0; 1160 } 1161 1162 elem.each(function(){ 1163 1164 var data = []; 1165 var options = []; 1166 if( $(this).attr('data-content') ){ 1167 data = JSON.parse($(this).attr('data-content')); 1168 } 1169 if( $(this).attr('data-options') ){ 1170 options = JSON.parse($(this).attr('data-options')); 1171 } 1172 1173 if( $(this).attr('data-type') == 'doughnut' || $(this).attr('data-type') == 'pie' ){ 1174 if( options.legend.position == 'right' || options.legend.position == 'left' ){ 1175 if( gdlr_core_display == 'mobile-portrait' || gdlr_core_display == 'mobile-landscape' ){ 1176 options.legend.orig_position = options.legend.position; 1177 options.legend.position = 'bottom'; 1178 $(this).attr('width', $(this).width()); 1179 $(this).attr('height', $(this).width() * 1); 1180 } 1181 } 1182 } 1183 options.onResize = function(chart, size){ 1184 if( chart.config.type == 'doughnut' || chart.config.type == 'pie' ){ 1185 if( chart.config.options.legend.position == 'right' || chart.config.options.legend.position == 'left' ){ 1186 if( gdlr_core_display == 'mobile-portrait' || gdlr_core_display == 'mobile-landscape' ){ 1187 chart.config.options.legend.orig_position = chart.config.options.legend.position; 1188 chart.config.options.legend.position = 'bottom'; 1189 chart.aspectRatio = 1; 1190 } 1191 }else if( typeof(chart.config.options.legend.orig_position) != 'undefined' ){ 1192 if( gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop' ){ 1193 chart.config.options.legend.position = chart.config.options.legend.orig_position; 1194 chart.aspectRatio = 2; 1195 } 1196 } 1197 1198 } 1199 1200 } 1201 1202 new Chart($(this), { 1203 type: $(this).attr('data-type')? $(this).attr('data-type'): 'pie', 1204 data: data, 1205 options: options 1206 }); 1207 1208 }); 1209 1210 } // gdlr_core_chart_js 1211 1212 // tab 1213 $.fn.gdlr_core_tab = function( filter_elem ){ 1214 1215 if( typeof(filter_elem) == 'undefined' ){ 1216 var elem = $(this).find('.gdlr-core-tab-item, .gdlr-core-tab-action, .gdlr-core-roadmap-item, .gdlr-core-tab-feature-item, .gdlr-core-tab-feature2-item, .gdlr-core-tab-feature3-item, .gdlr-core-tab-featurev-item'); 1217 }else{ 1218 var elem = filter_elem.filter('.gdlr-core-tab-item, .gdlr-core-tab-action, .gdlr-core-roadmap-item, .gdlr-core-tab-feature-item, .gdlr-core-tab-feature2-item, .gdlr-core-tab-feature3-item, .gdlr-core-tab-featurev-item'); 1219 } 1220 1221 elem.each(function(){ 1222 1223 // click action 1224 $(this).find('.gdlr-core-tab-item-title, .gdlr-core-tab-action-title, .gdlr-core-roadmap-item-head, .gdlr-core-tab-feature-title-wrap, .gdlr-core-tab-feature2-title-wrap, .gdlr-core-tab-feature3-title-wrap, .gdlr-core-tab-featurev-title').click(function(){ 1225 if( $(this).hasClass('gdlr-core-active') ) return; 1226 1227 var tab_id = $(this).attr('data-tab-id'); 1228 1229 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1230 1231 // for tab feature vertical 1232 if( $(this).is('.gdlr-core-tab-featurev-title') ){ 1233 var parent = $(this).parent().parent(); 1234 1235 parent.closest('.gdlr-core-tab-featurev-item').find('.gdlr-core-tab-featurev-background-switch').each(function(){ 1236 $(this).children().removeClass('gdlr-core-active'); 1237 $(this).children('[data-tab-id="' + tab_id + '"]').addClass('gdlr-core-active'); 1238 });
1239 }else{ 1240 var parent = $(this).parent(); 1241 } 1242 parent.siblings('.gdlr-core-tab-item-content-wrap, .gdlr-core-tab-action-content-wrap, .gdlr-core-roadmap-item-content-wrap, .gdlr-core-tab-feature-item-content-wrap, .gdlr-core-tab-feature2-item-content-wrap, .gdlr-core-tab-feature3-item-content-wrap, .gdlr-core-tab-featurev-item-content-wrap').each(function(){ 1243 var active_tab = $(this).children('[data-tab-id="' + tab_id + '"]'); 1244 1245 if( active_tab.length ){ 1246 active_tab.fadeIn(200).siblings().hide(); 1247 }else{ 1248 $(this).children().hide(); 1249 } 1250 }); 1251 1252 }); 1253 1254 // hover action 1255 if( !(gdlr_core_mobile || gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') && 1256 $(this).is('.gdlr-core-tab-feature2-item, .gdlr-core-tab-feature3-item') ){ 1257 1258 var slide_bar_width = 35; 1259 var slide_bar = $(this).find('.gdlr-core-tab-feature2-bottom-slide-bar, .gdlr-core-tab-feature3-bottom-slide-bar'); 1260 var active_tab = slide_bar.siblings('.gdlr-core-active'); 1261 1262 if( active_tab.length ){ 1263 if( active_tab.is('.gdlr-core-tab-feature3-title-wrap') ){ 1264 slide_bar_width = active_tab.outerWidth(); 1265 } 1266 slide_bar.css({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - slide_bar_width)/2 }); 1267 } 1268 $(window).resize(function(){ 1269 active_tab = slide_bar.siblings('.gdlr-core-active'); 1270 if( active_tab.is('.gdlr-core-tab-feature3-title-wrap') ){ 1271 slide_bar_width = active_tab.outerWidth(); 1272 } 1273 slide_bar.css({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - slide_bar_width)/2 }); 1274 }); 1275 $(this).find('.gdlr-core-tab-feature2-title-wrap, .gdlr-core-tab-feature3-title-wrap').click(function(){ 1276 active_tab = $(this); 1277 }); 1278 $(this).find('.gdlr-core-tab-feature2-title-wrap, .gdlr-core-tab-feature3-title-wrap').hover(function(){ 1279 if( $(this).is('.gdlr-core-tab-feature3-title-wrap') ){ 1280 slide_bar_width = $(this).outerWidth(); 1281 } 1282 slide_bar.animate({ width: slide_bar_width, left: $(this).position().left + ($(this).width() - slide_bar_width)/2 }, {duration: 200, queue: false}); 1283 }, function(){ 1284 if( $(this).is('.gdlr-core-tab-feature3-title-wrap') ){ 1285 slide_bar_width = $(this).outerWidth(); 1286 } 1287 slide_bar.animate({ width: slide_bar_width, left: active_tab.position().left + (active_tab.width() - slide_bar_width)/2 }, {duration: 200, queue: false}); 1288 }); 1289 1290 } 1291 1292 if( !(gdlr_core_mobile || gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait') && 1293 $(this).is('.gdlr-core-tab-style2-horizontal, .gdlr-core-tab-style2-vertical, .gdlr-core-tab-style3-horizontal') ){ 1294 1295 var horizontal = $(this).is('.gdlr-core-tab-style2-horizontal, .gdlr-core-tab-style3-horizontal'); 1296 var hover_line = $(this).find('.gdlr-core-tab-item-title-line'); 1297 var hover_line_w = 0; 1298 var hover_line_l = 0; 1299 1300 // initiate 1301 $(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-active').each(function(){ 1302 if( horizontal ){ 1303 hover_line_w = $(this).outerWidth(); 1304 hover_line_l = $(this).position().left; 1305 hover_line.css({ width: hover_line_w, left: hover_line_l }); 1306 }else{ 1307 hover_line_w = $(this).outerHeight(); 1308 hover_line_l = $(this).position().top; 1309 hover_line.css({ height: hover_line_w, top: hover_line_l }); 1310 } 1311 hover_line.addClass('gdlr-core-initiated'); 1312 }); 1313 $(window).on('resize gdlr-core-element-resize', function(){ 1314 $(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-active').each(function(){ 1315 if( horizontal ){ 1316 hover_line_w = $(this).outerWidth(); 1317 hover_line_l = $(this).position().left; 1318 hover_line.css({ width: hover_line_w, left: hover_line_l }); 1319 }else{ 1320 hover_line_w = $(this).outerHeight(); 1321 hover_line_l = $(this).position().top; 1322 hover_line.css({ height: hover_line_w, top: hover_line_l }); 1323 } 1324 });
1325 }); 1326 1327 // animate 1328 $(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-tab-item-title').hover(function(){ 1329 if( horizontal ){ 1330 hover_line.animate({ width: $(this).outerWidth(), left: $(this).position().left }, { duration: 300, easing: 'easeOutQuart', queue: false }); 1331 }else{ 1332 hover_line.animate({ height: $(this).outerHeight(), top: $(this).position().top }, { duration: 300, easing: 'easeOutQuart', queue: false }); 1333 } 1334 }, function(){ 1335 if( horizontal ){ 1336 hover_line.animate({ width: hover_line_w, left: hover_line_l }, { duration: 300, easing: 'easeOutQuart', queue: false }); 1337 }else{ 1338 hover_line.animate({ height: hover_line_w, top: hover_line_l }, { duration: 300, easing: 'easeOutQuart', queue: false }); 1339 } 1340 }); 1341 1342 // click 1343 $(this).children('.gdlr-core-tab-item-title-wrap').children('.gdlr-core-tab-item-title').click(function(){ 1344 if( horizontal ){ 1345 hover_line_w = $(this).outerWidth(); 1346 hover_line_l = $(this).position().left; 1347 hover_line.css({ width: hover_line_w, left: hover_line_l }); 1348 }else{ 1349 hover_line_w = $(this).outerHeight(); 1350 hover_line_l = $(this).position().top; 1351 hover_line.css({ height: hover_line_w, top: hover_line_l }); 1352 } 1353 }); 1354 } 1355 }); 1356 1357 return $(this); 1358 1359 } // gdlr_core_tab 1360 1361 $.fn.gdlr_core_price_table_tab = function( filter_elem ){ 1362 if( typeof(filter_elem) == 'undefined' ){ 1363 var elem = $(this).find('.gdlr-core-price-table-tab-title-wrap'); 1364 }else{ 1365 var elem = filter_elem.filter('.gdlr-core-price-table-tab-title-wrap'); 1366 } 1367 1368 elem.each(function(){ 1369 1370 var tab_title = $(this); 1371 tab_title.find('.gdlr-core-price-table-tab-title').on('click', function(){ 1372 if( $(this).hasClass('gdlr-core-active') ) return; 1373 1374 var price_tab = $(this).attr('data-price-tab'); 1375 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1376 tab_title.siblings('.gdlr-core-price-table-tab-content-wrap').find('[data-price-tab="' + price_tab + '"]').each(function(){ 1377 $(this).siblings('.gdlr-core-active').css({display: 'none'}).removeClass('gdlr-core-active'); 1378 $(this).fadeIn(200).addClass('gdlr-core-active'); 1379 }); 1380 }); 1381 1382 }); 1383 } 1384 1385 $.fn.gdlr_core_sly = function( filter_elem ){ 1386 1387 if( typeof(filter_elem) == 'undefined' ){ 1388 var elem = $(this).find('.gdlr-core-sly-slider'); 1389 }else{ 1390 var elem = filter_elem.filter('.gdlr-core-sly-slider'); 1391 } 1392 1393 elem.addClass('gdlr-core-after-init').each(function(){ 1394 var sly_slider = $(this); 1395 var sly_atts = { 1396 horizontal: 1, 1397 itemNav: 'basic', 1398 smart: 1, 1399 activateOn: 'click', 1400 mouseDragging: 1, 1401 touchDragging: 1, 1402 releaseSwing: 1, 1403 startAt: 0, 1404 scrollBy: 1, 1405 speed: 1000, 1406 elasticBounds: 1, 1407 easing: 'easeOutQuart', 1408 dragHandle: 1, 1409 dynamicHandle: 1, 1410 clickBar: 1, 1411 scrollBar: $(this).siblings('.gdlr-core-sly-scroll') 1412 }; 1413 1414 if( sly_slider.hasClass('gdlr-core-with-bullet') ){ 1415 var nav = $('<ul class="gdlr-core-sly-nav" ></ul>'); 1416 nav.insertAfter(sly_slider); 1417 1418 sly_atts['pagesBar'] = nav; 1419 sly_atts['activatePageOn'] = 'click'; 1420 } 1421 1422 sly_slider.sly(sly_atts); 1423 $(window).on('resize gdlr-core-element-resize', function(){ sly_slider.sly('reload'); }); 1424 }); 1425 1426 return $(this); 1427 1428 } // gdlr-core_sly 1429 1430 $.fn.gdlr_core_flexslider = function( filter_elem ){ 1431 1432 if( typeof(filter_elem) == 'undefined' ){ 1433 var elem = $(this).find('.gdlr-core-flexslider'); 1434 }else{ 1435 var elem = filter_elem.filter('.gdlr-core-flexslider'); 1436 } 1437 1438 elem.each(function(){ 1439 1440 var flex_attr = { 1441 useCSS: false, 1442 animation: 'fade', 1443 animationLoop: true, 1444 pauseOnHover: false, 1445 prevText: '<i class="arrow_carrot-left"></i>', 1446 nextText: '<i class="arrow_carrot-right"></i>' 1447 }; 1448 1449 if( $(this).attr('data-start-at') && $(this).attr('data-start-at') > 1 ){ 1450 flex_attr.startAt = $(this).attr('data-start-at') - 1; 1451 } 1452 1453 if( $(this).find('.gdlr-core-flexslider').length > 0 ){ 1454 $(this).children('ul.slides').addClass('parent-slides'); 1455 flex_attr.selector = '.parent-slides > li'; 1456 } 1457 1458 // variable settings 1459 if( $(this).attr('data-disable-autoslide') ){ 1460 flex_attr.slideshow = false; 1461 } 1462 if( $(this).attr('data-pausetime') ){ 1463 flex_attr.slideshowSpeed = parseInt($(this).attr('data-pausetime')); 1464 }
1465 if( $(this).attr('data-slidespeed') ){ 1466 flex_attr.animationSpeed = parseInt($(this).attr('data-slidespeed')); 1467 }else{ 1468 flex_attr.animationSpeed = 500; 1469 } 1470 1471 // for carousel 1472 if( $(this).attr('data-type') == 'carousel' ){ 1473 flex_attr.move = $(this).attr('data-move')? parseInt($(this).attr('data-move')): 1; 1474 flex_attr.animation = 'slide'; 1475 1476 // determine the spaces 1477 var column_num = parseInt($(this).attr('data-column')); 1478 if( $(this).attr('data-margin') ){ 1479 flex_attr.itemMargin = parseInt($(this).attr('data-margin')); 1480 }else{ 1481 flex_attr.itemMargin = 2 * parseInt($(this).children('ul.slides').children('li:first-child').css('margin-right')); 1482 } 1483 flex_attr.itemWidth = (($(this).width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin); 1484 1485 flex_attr.minItems = column_num; 1486 flex_attr.maxItems = column_num; 1487 1488 // if slide <= column no do nothing 1489 var slides = $(this).find('ul.slides').children(); 1490 var flex_item = $(this); 1491 if( slides.length < column_num ){ 1492 flex_item.addClass('gdlr-core-flex-inactive'); 1493 $(window).on('resize gdlr-core-element-resize', function(){ 1494 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){ 1495 flex_item.removeClass('gdlr-core-flex-inactive'); 1496 }else{ 1497 flex_item.addClass('gdlr-core-flex-inactive'); 1498 } 1499 }); 1500 } 1501 1502 1503 // resize window 1504 var t = $(this); 1505 $(window).on('resize gdlr-core-element-resize', function(){ 1506 if( t.data('goodlayers_flexslider') ){ 1507 var newWidth = ((t.width() + flex_attr.itemMargin) / column_num) - (flex_attr.itemMargin); 1508 t.data('goodlayers_flexslider').editItemWidth(newWidth); 1509 } 1510 }); 1511 1512 }else if( $(this).attr('data-effect') ){ 1513 if( $(this).attr('data-effect') == 'kenburn' ){ 1514 flex_attr.animation = 'fade'; 1515 }else{ 1516 flex_attr.animation = $(this).attr('data-effect'); 1517 } 1518 } 1519 1520 1521 // for navigation 1522 var data_nav = ['both', 'navigation', 'navigation-outer-plain-round', 'navigation-top', 'navigation-bottom', 'navigation-inner', 'navigation-outer']; 1523 if( !$(this).attr('data-nav') || data_nav.indexOf($(this).attr('data-nav')) != -1 ){ 1524 if( !$(this).hasClass('gdlr-core-bottom-nav-1') ){ /* old style fallback */ 1525 if( $(this).attr('data-nav-parent') ){ 1526 if( $(this).attr('data-nav-parent') == 'self' ){ 1527 flex_attr.customDirectionNav = $(this).find('.flex-prev, .flex-next'); 1528 }if( $(this).attr('data-nav-type') == 'custom' ){ 1529 flex_attr.customDirectionNav = $(this).closest('.' + $(this).attr('data-nav-parent')).find('.flex-prev, .flex-next'); 1530 }else{ 1531 $(this).closest('.' + $(this).attr('data-nav-parent')).each(function(){ 1532 var flex_nav = $('<ul class="flex-direction-nav">' + 1533 '<li class="flex-nav-prev"><a class="flex-prev" aria-label="left arrow" href="#"><i class="arrow_carrot-left"></i></a></li>' + 1534 '<li class="flex-nav-next"><a class="flex-next" aria-label="right arrow" href="#"><i class="arrow_carrot-right"></i></a></li>' + 1535 '</ul>'); 1536 1537 var flex_nav_position = $(this).find('.gdlr-core-flexslider-nav'); 1538 if( flex_nav_position.length ){ 1539 flex_nav_position.append(flex_nav); 1540 flex_attr.customDirectionNav = flex_nav.find('.flex-prev, .flex-next'); 1541 } 1542 }); 1543 } 1544 } 1545 } 1546 }else if( $(this).attr('data-nav') == 'touch-navigation' || $(this).attr('data-nav') == 'touch-navigation-bullet' ){ 1547 var navFollow = $('<div class="goodlayers-carousel-nav-follow"></div>'); 1548 navFollow.attr('data-type', 'touch-slide-black'); 1549 var container = $(this).find('ul.slides'); 1550 $(this).append( navFollow ); 1551 1552 container.get( 0 ).addEventListener('mousemove', function(e){ 1553 if( !navFollow.hasClass('goodlayers-active') ){ 1554 navFollow.addClass('goodlayers-active'); 1555 } 1556 1557 navFollow.css({'left': e.clientX, 'top': e.clientY}); 1558 }); 1559 container.on('mouseleave', function(){ 1560 navFollow.removeClass('goodlayers-active'); 1561 }); 1562 container.on('mouseenter', 'a', function(){ 1563 navFollow.addClass('goodlayers-over-link'); 1564 }); 1565 container.on('mouseleave', 'a', function(){ 1566 navFollow.removeClass('goodlayers-over-link'); 1567 }); 1568 1569 container.gdlr_core_monitor_swipe(); 1570 1571 flex_attr.directionNav = false; 1572 }else{ 1573 flex_attr.directionNav = false; 1574 } 1575 if( $(this).attr('data-nav') == 'both' || $(this).attr('data-nav') == 'bullet' || $(this).attr('data-nav') == 'touch-navigation-bullet' ){ 1576 flex_attr.controlNav = true; 1577 }else{ 1578 flex_attr.controlNav = false; 1579 } 1580 1581 // for thumbnail 1582 if( $(this).attr('data-thumbnail') ){ 1583 var thumbnail_slide = $(this).siblings('.gdlr-core-sly-slider'); 1584 1585 flex_attr.manualControls = thumbnail_slide.find('ul.slides li') 1586 flex_attr.controlNav = true; 1587 } 1588 1589 // center the navigation 1590 // add active class for kenburn effects 1591 if( $(this).attr('data-vcenter-nav') ){ 1592 flex_attr.start = function(slider){ 1593 $(slider).children('.gdlr-core-flexslider-custom-nav.gdlr-core-style-navigation-outer').each(function(){ 1594 $(this).insertAfter($(slider).children('.flex-viewport')); 1595 });
1596 if( slider.directionNav ){ 1597 $(window).on('resize gdlr-core-element-resize', function(){ 1598 slider.directionNav.each(function(){ 1599 var margin = -(slider.height() + $(this).outerHeight()) / 2; 1600 $(this).css('margin-top', margin); 1601 }); 1602 }); 1603 } 1604 if( typeof(slider.slides) != 'undefined' ){ 1605 $(window).trigger('gdlr-core-element-resize'); 1606 slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1607 } 1608 }; 1609 }else{ 1610 flex_attr.start = function(slider){ 1611 if( typeof(slider.slides) != 'undefined' ){ 1612 1613 if( $(slider).attr('data-controls-top-margin') ){ 1614 $(slider).find('.flex-control-nav').css({ 'margin-top': $(slider).attr('data-controls-top-margin') }); 1615 } 1616 1617 $(slider).children('.gdlr-core-flexslider-custom-nav.gdlr-core-style-navigation-bottom').each(function(){ 1618 $(this).insertAfter($(slider).children('.flex-viewport')); 1619 }); 1620 1621 $(window).trigger('gdlr-core-element-resize'); 1622 slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1623 } 1624 } 1625 } 1626 1627 // add the action for class 1628 flex_attr.after = function(slider){ 1629 slider.slides.filter('.flex-active-slide').addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 1630 } 1631 1632 // add outer frame class 1633 if( $(this).find('.gdlr-core-outer-frame-element').length > 0 ){ 1634 $(this).addClass('gdlr-core-with-outer-frame-element'); 1635 } 1636 1637 var slider_item = $(this).goodlayers_flexslider(flex_attr); 1638 1639 // custom next prev nav 1640 $(this).find('.gdlr-custom-flex-prev, .gdlr-custom-flex-next').on('click', function(){ 1641 if( $(this).is('.gdlr-custom-flex-prev') ){ 1642 slider_item.goodlayers_flexslider('prev'); 1643 }else{ 1644 slider_item.goodlayers_flexslider('next'); 1645 } 1646 }); 1647 // custom next prev nav 1648 $(this).closest('.gdlr-core-flexslider-outer').find('.gdlr-core-flexslider-left-content-nav').each(function(){ 1649 $(this).find('.gdlr-custom-flex-prev, .gdlr-custom-flex-next').on('click', function(){ 1650 if( $(this).is('.gdlr-custom-flex-prev') ){ 1651 slider_item.goodlayers_flexslider('prev'); 1652 }else{ 1653 slider_item.goodlayers_flexslider('next'); 1654 } 1655 }); 1656 }); 1657 // touch slide 1658 $(this).find('ul.slides').on('swipeleft', function(){ 1659 slider_item.goodlayers_flexslider('next'); 1660 }); 1661 $(this).find('ul.slides').on('swiperight', function(){ 1662 slider_item.goodlayers_flexslider('prev'); 1663 }); 1664 1665 }); 1666 1667 return $(this); 1668 1669 } // gdlr-core-flexslier 1670 1671 window.gdlr_core_sticky_sidebar = function( filter_elem ){ 1672 1673 if( typeof(filter_elem) == 'undefined' ){ 1674 this.elem = $(this).find('.gdlr-core-sticky-sidebar'); 1675 }else{ 1676 this.elem = filter_elem.filter('.gdlr-core-sticky-sidebar'); 1677 } 1678 1679 this.init(); 1680 1681 } 1682 gdlr_core_sticky_sidebar.prototype = { 1683 1684 init: function(){ 1685 1686 var t = this; 1687 t.elem.each(function(){ 1688 $(this).find('.gdlr-core-pbf-sidebar-left, .gdlr-core-pbf-sidebar-right, .gdlr-core-sidebar-script').each(function(){ 1689 1690 var sidebar_item = $(this); 1691 var sidebar_wrap = sidebar_item.parent(); 1692 var sidebar_sub = $('<div></div>'); 1693 1694 var prev_scroll = 0; 1695 $(window).on('scroll resize', function(e){ 1696 1697 // sidebar larger than content 1698 if( sidebar_item.outerHeight() >= sidebar_wrap.outerHeight() ){ 1699 t.return_sidebar_pos(sidebar_sub, sidebar_item); 1700 return; 1701 } 1702 1703 // not in desktop 1704 if( gdlr_core_display != 'desktop' ){ 1705 t.return_sidebar_pos(sidebar_sub, sidebar_item); 1706 return; 1707 } 1708 1709 var scroll_pos = $(window).scrollTop(); 1710 var scroll_direction = (prev_scroll > scroll_pos)? 'up': 'down'; 1711 prev_scroll = scroll_pos; 1712 1713 // sidebar smaller than screen 1714 if( $(window).height() > sidebar_item.height() ){ 1715 1716 if( scroll_pos <= sidebar_wrap.offset().top ){ 1717 1718 if( sidebar_item.hasClass('gdlr-core-fixed-sidebar') || sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){ 1719 t.return_sidebar_pos(sidebar_sub, sidebar_item); 1720 } 1721 1722 }else{ 1723 1724 // overflow the content - stick to the bottom 1725 if( scroll_pos + sidebar_item.outerHeight() >= sidebar_wrap.offset().top + sidebar_wrap.outerHeight() ){ 1726 1727 if( !sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){ 1728 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1729 1730 sidebar_item.addClass('gdlr-core-fixed-bottom-sidebar').removeClass('gdlr-core-fixed-sidebar'); 1731 sidebar_item.css({ 1732 'position': 'absolute', 1733 'top': 'auto', 1734 'bottom': 0, 1735 'left': sidebar_sub.position().left, 1736 'width': sidebar_sub.outerWidth() 1737 });
1738 } 1739 1740 // inside the content - fixed at the top 1741 }else{ 1742 1743 if( !sidebar_item.hasClass('gdlr-core-fixed-sidebar') ){ 1744 1745 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1746 1747 sidebar_item.addClass('gdlr-core-fixed-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar'); 1748 sidebar_item.css({ 1749 'position': 'fixed', 1750 'top': 0, 1751 'bottom': 'auto', 1752 'width': sidebar_sub.outerWidth() 1753 }); 1754 sidebar_item.css({ 1755 'left': sidebar_sub.offset().left, 1756 }); 1757 1758 } 1759 1760 } 1761 1762 if( e.type == 'resize' ){ 1763 1764 if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){ 1765 sidebar_item.css({ 1766 'width': sidebar_sub.outerWidth(), 1767 'left': sidebar_sub.position().left, 1768 }); 1769 }else if( sidebar_item.hasClass('gdlr-core-fixed-sidebar') ){ 1770 sidebar_item.css({ 1771 'width': sidebar_sub.outerWidth(), 1772 'left': sidebar_sub.offset().left, 1773 }); 1774 } 1775 1776 } 1777 1778 } 1779 1780 // sidebar larger than screen 1781 }else{ 1782 1783 // to the top 1784 if( scroll_pos <= sidebar_wrap.offset().top ){ 1785 1786 if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-stick-bottom-sidebar') || 1787 sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') || sidebar_item.hasClass('gdlr-core-stick-top-sidebar') ){ 1788 t.return_sidebar_pos(sidebar_sub, sidebar_item); 1789 } 1790 1791 }else{ 1792 1793 // scroll direction down 1794 if( scroll_direction == 'down' ){ 1795 1796 if( sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') ){ 1797 1798 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1799 1800 sidebar_item.addClass('gdlr-core-stick-top-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-bottom-sidebar'); 1801 sidebar_item.css({ 1802 'position': 'absolute', 1803 'top': scroll_pos - sidebar_wrap.offset().top, 1804 'bottom': 'auto', 1805 'left': sidebar_sub.position().left, 1806 'width': sidebar_sub.outerWidth() 1807 }); 1808 1809 // stick at the bottom 1810 }else if( scroll_pos + $(window).height() >= sidebar_wrap.offset().top + sidebar_wrap.outerHeight() ){ 1811 1812 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1813 1814 sidebar_item.addClass('gdlr-core-stick-bottom-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-top-sidebar'); 1815 sidebar_item.css({ 1816 'position': 'absolute', 1817 'top': 'auto', 1818 'bottom': 0, 1819 'left': sidebar_sub.position().left, 1820 'width': sidebar_sub.outerWidth() 1821 }); 1822 1823 // fixed at the bottom 1824 }else if( scroll_pos + $(window).height() > sidebar_item.offset().top + sidebar_item.outerHeight() ){ 1825 1826 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1827 1828 sidebar_item.addClass('gdlr-core-fixed-bottom-sidebar').removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-stick-top-sidebar gdlr-core-fixed-top-sidebar'); 1829 sidebar_item.css({ 1830 'position': 'fixed', 1831 'top': 'auto', 1832 'bottom': '0', 1833 'left': sidebar_sub.offset().left, 1834 'width': sidebar_sub.outerWidth() 1835 }); 1836 } 1837 1838 // scroll direction up 1839 }else{ 1840 1841 if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') ){ 1842 1843 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1844 1845 sidebar_item.addClass('gdlr-core-stick-bottom-sidebar').removeClass('gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar gdlr-core-stick-top-sidebar'); 1846 sidebar_item.css({ 1847 'position': 'absolute', 1848 'top': scroll_pos + $(window).height() - sidebar_item.outerHeight() - sidebar_wrap.offset().top, 1849 'bottom': 'auto', 1850 'left': sidebar_sub.position().left, 1851 'width': sidebar_sub.outerWidth() 1852 });
1853 1854 }else{ 1855 1856 // stick at the top 1857 if( scroll_pos < sidebar_item.offset().top ){ 1858 1859 t.set_sidebar_sub(sidebar_sub, sidebar_item); 1860 1861 sidebar_item.addClass('gdlr-core-fixed-top-sidebar').removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-stick-top-sidebar'); 1862 sidebar_item.css({ 1863 'position': 'fixed', 1864 'top': '0', 1865 'bottom': 'auto', 1866 'left': sidebar_sub.offset().left, 1867 'width': sidebar_sub.outerWidth() 1868 }); 1869 1870 } 1871 } 1872 1873 1874 1875 } 1876 1877 if( e.type == 'resize' ){ 1878 if( sidebar_item.hasClass('gdlr-core-stick-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-stick-top-sidebar') ){ 1879 sidebar_item.css({ 1880 'width': sidebar_sub.outerWidth(), 1881 'left': sidebar_sub.position().left, 1882 }); 1883 }else if( sidebar_item.hasClass('gdlr-core-fixed-bottom-sidebar') || sidebar_item.hasClass('gdlr-core-fixed-top-sidebar') ){ 1884 sidebar_item.css({ 1885 'width': sidebar_sub.outerWidth(), 1886 'left': sidebar_sub.offset().left, 1887 }); 1888 } 1889 } 1890 1891 } 1892 } 1893 1894 }); // window scroll 1895 1896 }); 1897 }); 1898 1899 }, 1900 1901 set_sidebar_sub: function(sidebar_sub, sidebar_item){ 1902 1903 if(sidebar_item.hasClass('gdlr-core-sidebar-sub-added')) return; 1904 1905 // set the width 1906 var sidebar_class = ''; 1907 sidebar_item.each(function(){ 1908 var className = this.className.match(/gdlr-core-column-\d+/); 1909 if( className ){ 1910 sidebar_class = className[0]; 1911 } 1912 }); 1913 sidebar_sub.addClass(sidebar_class); 1914 1915 // set position 1916 sidebar_sub.css({ 1917 'float': sidebar_item.css('float'), 1918 'height': 20, 1919 'background': '#fd9' 1920 }); 1921 1922 sidebar_sub.insertAfter(sidebar_item); 1923 sidebar_item.addClass('gdlr-core-sidebar-sub-added'); 1924 }, 1925 1926 return_sidebar_pos: function(sidebar_sub, sidebar_item){ 1927 sidebar_item.css({'position': '', 'top': '', 'bottom': '', 'left': '', 'width': '', 'height': ''}); 1928 sidebar_item.removeClass('gdlr-core-fixed-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-sidebar-sub-added'); 1929 sidebar_item.removeClass('gdlr-core-stick-bottom-sidebar gdlr-core-fixed-bottom-sidebar gdlr-core-fixed-top-sidebar'); 1930 sidebar_sub.remove(); 1931 } 1932 1933 } 1934 1935 $.fn.gdlr_core_isotope = function( filter_elem ){ 1936 1937 if(typeof($.fn.isotope) == 'function'){ 1938 1939 if( typeof(filter_elem) == 'undefined' ){ 1940 var elem = $(this).find('[data-layout="masonry"]'); 1941 }else{ 1942 var elem = filter_elem.filter('[data-layout="masonry"]'); 1943 } 1944 1945 elem.each(function(){ 1946 1947 var t = $(this); 1948 if( t.children('ul.products').length ){ 1949 t = t.children('ul.products'); 1950 } 1951 var columnSize = t.width() / 60; 1952 1953 t.isotope({ 1954 itemSelector: '.gdlr-core-item-list', 1955 layoutMode: 'masonry', 1956 masonry:{ 1957 columnWidth: columnSize 1958 } 1959 }); 1960 t.isotope(); 1961 1962 t.find('.gdlr-core-item-list').gdlr_core_animate_list_item(); 1963 1964 // resize event 1965 $(window).on('resize gdlr-core-element-resize', function(){ 1966 1967 columnSize = t.width() / 60; 1968 1969 t.isotope({ 1970 masonry:{ 1971 columnWidth: columnSize 1972 } 1973 }); 1974 }); 1975 }); 1976 1977 } 1978 1979 return $(this); 1980 1981 } // gdlr-core-isotope 1982 $.fn.gdlr_core_animate_list_item = function(){ 1983 1984 var ux_items = $(this).get(); 1985 1986 // run the ux in order with delay 1987 var ux_interval = setInterval(function(){ 1988 1989 if( ux_items.length > 0 ){ 1990 // animate the ux item 1991 var ux_animate = $(ux_items.shift()); 1992 var animation_duration = '600ms'; 1993 1994 ux_animate.css({'animation-duration': animation_duration}); 1995 ux_animate.addClass('gdlr-core-animate'); 1996 1997 // remove selector 1998 setTimeout(function(){ 1999 ux_animate.css({'animation-duration': ''}) 2000 .addClass('gdlr-core-animate-end') 2001 .removeClass('gdlr-core-animate gdlr-core-animate-init'); 2002 }, parseInt(animation_duration)); 2003 2004 }else{ 2005 clearInterval(ux_interval); 2006 } 2007 }, 200); 2008 2009 } 2010 2011 $.fn.gdlr_core_lightbox = function( filter_elem ){ 2012 2013 // ilightbox 2014 if( typeof($.iLightBox) == 'function' ){ 2015 2016 if( typeof(filter_elem) == 'undefined' ){ 2017 var ilightbox = $(this).find('.gdlr-core-ilightbox'); 2018 }else{ 2019 var ilightbox = filter_elem.filter('.gdlr-core-ilightbox'); 2020 } 2021 2022 var ilightbox_atts = {}; 2023 var ilightbox_groups = []; 2024 2025 if( typeof(gdlr_core_pbf.ilightbox_skin) != 'undefined' ){ 2026 ilightbox_atts['skin'] = gdlr_core_pbf.ilightbox_skin; 2027 } 2028 2029 ilightbox.each(function(){ 2030 if( $(this).attr('data-ilightbox-group') ){ 2031 if( ilightbox_groups.indexOf($(this).attr('data-ilightbox-group')) == -1 ){ 2032 ilightbox_groups.push($(this).attr('data-ilightbox-group')); 2033 } 2034 }else{ 2035 $(this).iLightBox(ilightbox_atts); 2036 } 2037 }); 2038 2039 for( var key in ilightbox_groups ){ 2040 $(this).find('.gdlr-core-ilightbox[data-ilightbox-group="' + ilightbox_groups[key] + '"]').iLightBox(ilightbox_atts); 2041 } 2042 2043 }else if( typeof($.fn.lightGallery) == 'function' ){ 2044 2045 if( typeof(filter_elem) == 'undefined' ){ 2046 var lightgallery = $(this).find('.gdlr-core-lightgallery'); 2047 }else{ 2048 var lightgallery = filter_elem.filter('.gdlr-core-lightgallery'); 2049 } 2050 2051 var lightbox_groups = []; 2052 2053 lightgallery.each(function(){ 2054 if( $(this).attr('data-lightbox-group') ){ 2055 if( lightbox_groups.indexOf($(this).attr('data-lightbox-group')) == -1 ){ 2056 lightbox_groups.push($(this).attr('data-lightbox-group')); 2057 } 2058 }else{ 2059 $(this).lightGallery({ selector: 'this' });
2060 } 2061 }); 2062 2063 for( var key in lightbox_groups ){ 2064 var group_selector = '.gdlr-core-lightgallery[data-lightbox-group="' + lightbox_groups[key] + '"]'; 2065 2066 lightgallery.filter(group_selector).first().lightGallery({ 2067 selector: group_selector, 2068 selectWithin: 'body', 2069 thumbnail: false 2070 }); 2071 } 2072 2073 }else if( typeof(lightGallery) == 'function' ){ 2074 2075 if( typeof(filter_elem) == 'undefined' ){ 2076 var lightgallery = $(this).find('.gdlr-core-lightgallery'); 2077 }else{ 2078 var lightgallery = filter_elem.filter('.gdlr-core-lightgallery'); 2079 } 2080 2081 var lightbox_groups = []; 2082 2083 lightgallery.each(function(){ 2084 if( $(this).attr('data-lightbox-group') ){ 2085 if( lightbox_groups.indexOf($(this).attr('data-lightbox-group')) == -1 ){ 2086 lightbox_groups.push($(this).attr('data-lightbox-group')); 2087 } 2088 }else{ 2089 lightGallery($(this).get(0), { 2090 selector: 'this', 2091 plugins: [lgVideo, lgShare], 2092 zoomFromOrigin: false 2093 }); 2094 } 2095 }); 2096 2097 for( var key in lightbox_groups ){ 2098 var group_selector = '.gdlr-core-lightgallery[data-lightbox-group="' + lightbox_groups[key] + '"]'; 2099 2100 lightGallery(document.body, { 2101 selector: group_selector, 2102 plugins: [lgVideo, lgShare], 2103 zoomFromOrigin: false 2104 }); 2105 } 2106 2107 } 2108 2109 // lightbox gallery 2110 if( typeof(filter_elem) == 'undefined' ){ 2111 var gallery_lb = $(this).find('[data-gallery-lb]'); 2112 }else{ 2113 var gallery_lb = filter_elem.filter('[data-gallery-lb]'); 2114 } 2115 2116 gallery_lb.click(function(){ 2117 if( typeof($.iLightBox) != 'undefined' ){ 2118 $.iLightBox($(this).data('gallery-lb')); 2119 }else if(typeof(Strip) != 'undefined' ){ 2120 Strip.show($(this).data('gallery-lb')); 2121 }else if(typeof($.fn.lightGallery) == 'function'){ 2122 $(this).lightGallery({ 2123 dynamic: true, 2124 dynamicEl: $(this).data('gallery-lb'), 2125 thumbnail: false 2126 }); 2127 }else if( typeof(lightGallery) == 'function' ){ 2128 lightGallery($(this), { 2129 dynamic: true, 2130 dynamicEl: $(this).data('gallery-lb'), 2131 thumbnail: false 2132 }).openGallery(); 2133 } 2134 2135 return false; 2136 }); 2137 2138 2139 // image overlay 2140 if( typeof(filter_elem) == 'undefined' ){ 2141 var center_overlay = $(this).find('.gdlr-core-image-overlay-center, .gdlr-core-image-overlay-center-icon'); 2142 }else{ 2143 var center_overlay = filter_elem.filter('.gdlr-core-image-overlay-center, .gdlr-core-image-overlay-center-icon'); 2144 } 2145 2146 center_overlay.each(function(){ 2147 2148 // for portfolio overlay content style 2149 if( $(this).hasClass('gdlr-core-image-overlay-center') ){ 2150 var overlay_content = $(this).children('.gdlr-core-image-overlay-content'); 2151 var wrap_height = $(this).outerHeight() - (2 * parseInt(overlay_content.css('bottom'))); 2152 2153 var overlay_icon = overlay_content.children('.gdlr-core-portfolio-icon-wrap'); 2154 var icon_margin = (wrap_height - (overlay_content.outerHeight() - parseInt(overlay_icon.css('margin-bottom')))) / 2; 2155 if( icon_margin > 20 ){ 2156 overlay_icon.css('margin-bottom', icon_margin); 2157 } 2158 2159 // normal centering 2160 }else{ 2161 var content_offset = 0; 2162 if( $(this).children('.gdlr-core-image-overlay-content-offset').length ){ 2163 content_offset = $(this).children('.gdlr-core-image-overlay-content-offset').outerHeight(true); 2164 } 2165 2166 $(this).children('.gdlr-core-image-overlay-content').each(function(){ 2167 $(this).css({ 'margin-top': -( ($(this).outerHeight() + content_offset) / 2 ) }); 2168 }); 2169 } 2170 2171 }); 2172 $(window).on('resize gdlr-core-element-resize', function(){ 2173 center_overlay.each(function(){ 2174 // for portfolio style 2175 if( $(this).hasClass('gdlr-core-image-overlay-center') ){ 2176 var overlay_content = $(this).children('.gdlr-core-image-overlay-content'); 2177 var wrap_height = $(this).outerHeight() - (2 * parseInt(overlay_content.css('bottom'))); 2178 2179 var overlay_icon = overlay_content.children('.gdlr-core-portfolio-icon-wrap'); 2180 var icon_margin = (wrap_height - (overlay_content.outerHeight() - parseInt(overlay_icon.css('margin-bottom')))) / 2; 2181 if( icon_margin > 20 ){ 2182 overlay_icon.css('margin-bottom', icon_margin); 2183 } 2184 2185 // normal centering 2186 }else{ 2187 var content_offset = 0; 2188 if( $(this).children('.gdlr-core-image-overlay-content-offset').length ){ 2189 content_offset = $(this).children('.gdlr-core-image-overlay-content-offset').outerHeight(true); 2190 } 2191 2192 $(this).children('.gdlr-core-image-overlay-content').each(function(){ 2193 $(this).css({ 'margin-top': -( ($(this).outerHeight() + content_offset) / 2 ) }); 2194 });
2195 } 2196 }); 2197 }); 2198 2199 return $(this); 2200 } 2201 2202 $.fn.gdlr_core_set_image_height = function(){ 2203 2204 var all_image = $(this).find('img'); 2205 2206 all_image.each(function(){ 2207 var img_width = $(this).attr('width'); 2208 var img_height = $(this).attr('height'); 2209 2210 if( img_width && img_height ){ 2211 var parent_item = $(this).parent('.gdlr-core-temp-image-wrap'); 2212 2213 if( parent_item.length ){ 2214 parent_item.height((img_height * $(this).parent().width()) / img_width); 2215 }else{ 2216 parent_item = $('<div class="gdlr-core-temp-image-wrap" ></div>'); 2217 parent_item.css('height', ((img_height * $(this).closest('span, div').width()) / img_width)); 2218 $(this).wrap(parent_item); 2219 } 2220 }else{ 2221 return; 2222 } 2223 }); 2224 $(window).on('resize gdlr-core-element-resize', function(e){ 2225 all_image.each(function(){ 2226 var parent_item = $(this).parent('.gdlr-core-temp-image-wrap'); 2227 2228 if( parent_item.length ){ 2229 $(this).unwrap(); 2230 } 2231 }); 2232 2233 $(window).unbind('resize', e.handleObj.handler, e); 2234 }); 2235 2236 return $(this); 2237 } // gdlr_core_set_image_height 2238 2239 // to set full height wrapper / column 2240 window.gdlr_core_set_full_height = function( container, filter_elem ){ 2241 if( typeof(filter_elem) == 'undefined' ){ 2242 this.elements = container.find('.gdlr-core-wrapper-full-height, .gdlr-core-column-full-height'); 2243 }else{ 2244 this.elements = filter_elem.filter('.gdlr-core-wrapper-full-height, .gdlr-core-column-full-height'); 2245 } 2246 2247 if( this.elements.length ){ 2248 this.init(); 2249 } 2250 } 2251 gdlr_core_set_full_height.prototype = { 2252 2253 init: function(){ 2254 2255 var t = this; 2256 2257 t.resize(); 2258 $(window).on('load resize gdlr-core-element-resize', function(){ t.resize(); }); 2259 }, 2260 2261 resize: function(){ 2262 2263 this.elements.each(function(){ 2264 var offset = $(this).attr('data-decrease-height')? parseInt($(this).attr('data-decrease-height')): 0; 2265 2266 $(this).css('min-height', $(window).height() - offset); 2267 2268 if( $(this).hasClass('gdlr-core-full-height-center') ){ 2269 $(this).children('.gdlr-core-full-height-pre-spaces').remove(); 2270 2271 var pre_space = ($(this).height() - $(this).children('.gdlr-core-full-height-content').outerHeight(true)) / 2; 2272 if( pre_space > 0 ){ 2273 $(this).prepend($('<div class="gdlr-core-full-height-pre-spaces" ></div>').height(pre_space)); 2274 } 2275 } 2276 }); 2277 2278 } 2279 }; 2280 2281 // sync height among items 2282 window.gdlr_core_sync_height = function( container, filter_elem ){ 2283 2284 // for half height item 2285 this.set_half_height(container); 2286 2287 // sync height 2288 if( typeof(window.gdlr_core_sync_height_elem) != 'undefined' ){ 2289 window.gdlr_core_sync_height_elem.reinit(); 2290 return; 2291 } 2292 window.gdlr_core_sync_height_elem = this; 2293 2294 if( typeof(filter_elem) == 'undefined' ){ 2295 this.elements = container.find('[data-sync-height]'); 2296 }else{ 2297 this.elements = filter_elem.filter('[data-sync-height]'); 2298 } 2299 2300 this.elements_group = []; 2301 this.container = container; 2302 this.init(); 2303 } 2304 gdlr_core_sync_height.prototype = { 2305 2306 init: function(){ 2307 2308 var t = this; 2309 t.group_elements(); 2310 t.set_height(); 2311 2312 $(window).on('load resize gdlr-core-element-resize', function(){ t.set_height(); }); 2313 }, 2314 2315 reinit: function(){ 2316 2317 if( !this.container.is('body, .gdlr-core-page-builder-body') ){ 2318 this.container = this.container.closest('.gdlr-core-page-builder-body'); 2319 } 2320 2321 this.elements = this.container.find('[data-sync-height]'); 2322 this.group_elements(); 2323 this.set_height(); 2324 2325 }, 2326 2327 group_elements: function(){ 2328 2329 var t = this; 2330 2331 // do flipbox first 2332 t.elements.filter('.gdlr-core-flipbox-front, .gdlr-core-feature-box').each(function(){ 2333 if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){ 2334 t.elements_group.push($(this).attr('data-sync-height')); 2335 } 2336 }); 2337 2338 // do the rest elements 2339 t.elements.each(function(){ 2340 if( t.elements_group.indexOf($(this).attr('data-sync-height')) == -1 ){ 2341 t.elements_group.push($(this).attr('data-sync-height')); 2342 } 2343 }); 2344 }, 2345 2346 set_height: function(){ 2347 2348 var t = this; 2349 2350 // revert to default value 2351 t.elements.css('height', 'auto').children('.gdlr-core-sync-height-pre-spaces').remove(); 2352 t.elements.find('.gdlr-core-sync-height-offset').remove(); 2353 2354 var sync_element = t.elements; 2355 if( gdlr_core_display == 'mobile-landscape' || gdlr_core_display == 'mobile-portrait' ){ 2356 sync_element = sync_element.filter('.gdlr-core-flipbox-front, .gdlr-core-flipbox-back, .gdlr-core-hover-content-front, .gdlr-core-hover-content-back'); 2357 } 2358 2359 // setting the height by each group 2360 for( var key in t.elements_group ){
2361 var max_height = 0; 2362 2363 // determine max height 2364 sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){ 2365 if( $(this).outerHeight() > max_height ){ 2366 max_height = $(this).outerHeight(); 2367 } 2368 }); 2369 2370 // set the height 2371 sync_element.filter('[data-sync-height="' + t.elements_group[key] + '"]').each(function(){ 2372 2373 // set the offset space to the bottom 2374 var offset = parseInt(max_height - $(this).outerHeight()); 2375 var offset_item = $(this).find('[data-sync-height-offset]'); 2376 if( offset_item.length && offset > 0 ){ 2377 $('<div class="gdlr-core-sync-height-offset" ></div>').css('height', offset).insertBefore(offset_item); 2378 } 2379 2380 $(this).css('height', max_height); 2381 2382 // flipbox 2383 if( $(this).hasClass('gdlr-core-flipbox-front') ){ 2384 $(this).parent().css('height', max_height); 2385 } 2386 2387 // center the content if selected 2388 if( $(this).is('[data-sync-height-center]') ){ 2389 var content = $(this).children('.gdlr-core-sync-height-content'); 2390 2391 // determine top padding for centering content 2392 var padding_top = max_height; 2393 if( content.length > 0 ){ 2394 padding_top -= content.outerHeight(); 2395 }else{ 2396 $(this).children().each(function(){ 2397 padding_top -= $(this).outerHeight(); 2398 }); 2399 } 2400 padding_top = padding_top / 2; 2401 padding_top = padding_top - (parseInt($(this).css('padding-top')) + parseInt($(this).css('border-top-width'))); 2402 2403 // insert the spaces 2404 if( padding_top > 0 ){ 2405 var spaces_item = $('<div class="gdlr-core-sync-height-pre-spaces" ></div>').css('padding-top', padding_top); 2406 var space_position = $(this).children('.gdlr-core-sync-height-space-position'); 2407 if( space_position.length > 0 ){ 2408 spaces_item.insertBefore(space_position); 2409 }else{ 2410 $(this).prepend(spaces_item); 2411 } 2412 } 2413 } 2414 2415 }); 2416 } 2417 2418 }, 2419 2420 set_half_height: function( container ){ 2421 2422 container.find('.gdlr-core-half-height').each(function(){ 2423 var temp = $(this); 2424 if( !gdlr_core_mobile && (gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop') ){ 2425 var temp_height = temp.outerHeight(); 2426 temp.gdlr_core_set_image_height(); 2427 temp.css('height', temp_height / 2); 2428 temp.find('img').css('margin-top', -temp_height/4); 2429 } 2430 $(window).on('load resize', function(){ 2431 temp.css('height', 'auto'); 2432 temp.find('img').css('margin-top', '0'); 2433 if( !gdlr_core_mobile && (gdlr_core_display == 'tablet' || gdlr_core_display == 'desktop') ){ 2434 temp_height = temp.outerHeight(); 2435 temp.gdlr_core_set_image_height(); 2436 temp.css('height', temp_height / 2); 2437 temp.find('img').css('margin-top', -temp_height/4); 2438 } 2439 }); 2440 }); 2441 2442 } 2443 2444 }; // gdlr_core_sync_height.prototype 2445 2446 function gdlr_core_ajax_action(ajax_section, name, value){ 2447 2448 var now_loading = $('<div class="gdlr-core-now-loading" ></div>').hide(); 2449 2450 $.ajax({ 2451 type: 'POST', 2452 url: gdlr_core_pbf.ajax_url, 2453 data: { 2454 'action': ajax_section.attr('data-ajax'), 2455 'settings': ajax_section.data('settings'),
2456 'option': { 'name':name, 'value':value } 2457 }, 2458 dataType: 'json', 2459 beforeSend: function(jqXHR, settings){ 2460 // before send action 2461 if( ajax_section.attr('data-target-action') == 'replace' ){ 2462 ajax_section.siblings('.' + ajax_section.attr('data-target')).animate({opacity: 0}, 150); 2463 } 2464 2465 // for portfolio item 2466 if( (ajax_section.attr('data-target') == 'gdlr-core-portfolio-item-holder' || 2467 ajax_section.attr('data-target') == 'gdlr-core-blog-item-holder' || 2468 ajax_section.attr('data-target') == 'gdlr-core-product-item-holder' || 2469 ajax_section.attr('data-target') == 'gdlr-core-product-item-table-holder' || 2470 ajax_section.attr('data-target') == 'gdlr-core-personnel-item-holder') && 2471 ajax_section.attr('data-target-action') == 'replace' ){ 2472 2473 now_loading.insertBefore( ajax_section.siblings('.gdlr-core-portfolio-item-holder, .gdlr-core-personnel-item-holder, .gdlr-core-blog-item-holder, .gdlr-core-product-item-holder, .gdlr-core-product-item-table-holder') ); 2474 now_loading.fadeIn(200); 2475 } 2476 }, 2477 error: function(jqXHR, textStatus, errorThrown){ 2478 ajax_section.removeClass('gdlr-core-disable'); 2479 2480 console.log(jqXHR, textStatus, errorThrown); 2481 }, 2482 success: function(data){ 2483 2484 if( data.status == 'success' ){ 2485 if( data.content && ajax_section.attr('data-target') ){ 2486 if( ajax_section.attr('data-target-action') == 'append' ){ 2487 var content = $(data.content); 2488 ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){ 2489 2490 if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){ 2491 content.addClass('gdlr-core-animate-init'); 2492 } 2493 $(this).append(content); 2494 2495 content.gdlr_core_lightbox().gdlr_core_flexslider().gdlr_core_content_script().gdlr_core_set_image_height(); 2496 new gdlr_core_sync_height(content); 2497 2498 if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){ 2499 var addItems = $(this).isotope('addItems', content); 2500 $(this).isotope('layoutItems', addItems, true); 2501 }else if( content.is('.gdlr-core-flexslider') ){ 2502 content.gdlr_core_flexslider(content); 2503 } 2504 2505 content.gdlr_core_animate_list_item(); 2506 }); 2507 2508 if( data.load_more ){ 2509 if( data.load_more != 'none' ){ 2510 var load_more = $(data.load_more); 2511 ajax_section.parent().append(load_more); 2512 load_more.gdlr_core_ajax(load_more); 2513 load_more.css('display', 'none').slideDown(100); 2514 2515 ajax_section.remove(); 2516 }else{ 2517 ajax_section.slideUp(100, function(){ $(this).remove(); }); 2518 } 2519 } 2520 2521 }else if( ajax_section.attr('data-target-action') == 'replace' ){ 2522 var content = $(data.content); 2523 ajax_section.siblings('.' + ajax_section.attr('data-target')).each(function(){ 2524 if( ajax_section.is('.gdlr-core-pagination') ){ 2525 var scroll_position = $(this).offset().top - 120; 2526 if( $(window).scrollTop() > scroll_position ){ 2527 $('html, body').animate({ scrollTop: scroll_position }, { duration: 1500, easing: 'easeOutQuart', queue: false }); 2528 } 2529 } 2530 2531 var fix_height = false; 2532 var current_height = $(this).height(); 2533 2534 if( $(this).attr('data-layout') != 'masonry' || typeof($.fn.isotope) != 'function' ){ 2535 content.addClass('gdlr-core-animate-init'); 2536 } 2537 $(this).empty().append(content); 2538 2539 content.gdlr_core_lightbox().gdlr_core_flexslider().gdlr_core_fluid_video().gdlr_core_set_image_height(); 2540 new gdlr_core_sync_height(content); 2541 2542 var height_delay = 0; 2543 if( $(this).attr('data-layout') == 'masonry' && typeof($.fn.isotope) == 'function' ){ 2544 $(this).isotope('destroy'); 2545 $(this).parent().gdlr_core_isotope(); 2546 fix_height = true; 2547 }else if( content.is('.gdlr-core-flexslider') ){ 2548 content.gdlr_core_flexslider(content);
2549 height_delay = 300; 2550 }else{ 2551 content.gdlr_core_animate_list_item(); 2552 } 2553 2554 if( height_delay == 0 ){ 2555 var new_height = $(this).height(); 2556 $(this).css({height:current_height}).animate({'height':new_height, opacity:1}, {'duration':400, 'easing':'easeOutExpo', 'complete': function(){ 2557 if( !fix_height ){ $(this).css('height',''); } 2558 }}); 2559 }else{ 2560 var current_item = $(this); 2561 current_item.css('height', current_height); 2562 setTimeout(function(){ 2563 current_item.css('height', ''); 2564 var new_height = current_item.height(); 2565 current_item.css({height:current_height}).animate({'height':new_height, opacity:1}, {'duration':400, 'easing':'easeOutExpo', 'complete': function(){ 2566 if( !fix_height ){ current_item.css('height',''); } 2567 }}); 2568 }, height_delay); 2569 } 2570 2571 }); 2572 2573 // pagination 2574 if( data.pagination ){ 2575 ajax_section.siblings('.gdlr-core-pagination').slide
2575Up(100, function(){ $(this).remove(); }); 2576 2577 if( data.pagination != 'none' ){ 2578 var pagination = $(data.pagination); 2579 ajax_section.parent().append(pagination); 2580 pagination.gdlr_core_ajax(pagination); 2581 pagination.css('display', 'none').slideDown(100); 2582 } 2583 } 2584 2585 // load more button 2586 if( data.load_more ){ 2587 ajax_section.siblings('.gdlr-core-load-more-wrap').slideUp(100, function(){ $(this).remove(); }); 2588 2589 if( data.load_more != 'none' ){ 2590 var load_more = $(data.load_more); 2591 ajax_section.parent().append(load_more); 2592 load_more.gdlr_core_ajax(load_more); 2593 load_more.css('display', 'none').slideDown(100); 2594 } 2595 } 2596 2597 } 2598 } 2599 2600 if( typeof(data.settings) != 'undefined' ){ 2601 ajax_section.data('settings', data.settings); 2602 } 2603 2604 now_loading.fadeOut(200, function(){ 2605 $(this).remove(); 2606 ajax_section.removeClass('gdlr-core-disable'); 2607 }); 2608 }else{ 2609 ajax_section.removeClass('gdlr-core-disable'); 2610 } 2611 2612 } 2613 }); 2614 2615 } // gdlr_core_ajax_action 2616 $.fn.gdlr_core_ajax = function( filter_elem ){ 2617 2618 if( typeof(filter_elem) == 'undefined' ){ 2619 var elem = $(this).find('[data-ajax]'); 2620 }else{ 2621 var elem = filter_elem.filter('[data-ajax]'); 2622 } 2623 2624 elem.each(function(){ 2625 2626 var ajax_section = $(this); 2627 2628 // button click 2629 $(this).on('click', 'a, .gdlr-core-ajax-link', function(){ 2630 if( $(this).hasClass('gdlr-core-active') || ajax_section.hasClass('gdlr-core-disable') ){ 2631 return false; 2632 } 2633 2634 ajax_section.addClass('gdlr-core-disable'); 2635 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 2636 2637 var name = $(this).attr('data-ajax-name'); 2638 var value = $(this).attr('data-ajax-value'); 2639 2640 gdlr_core_ajax_action(ajax_section, name, value); 2641 2642 // for dropdown filterer 2643 var text = $(this).html(); 2644 $(this).closest('.gdlr-core-filterer-dropdown').each(function(){ 2645 $(this).siblings('.gdlr-core-filterer-dropdown-text').html(text); 2646 }); 2647 2648 if( $(this).is('a') ){ 2649 return false; 2650 } 2651 }); 2652 2653 // filter changed 2654 $(this).on('change', 'select', function(){ 2655 var name = $(this).attr('data-ajax-name'); 2656 var value = $(this).val(); 2657 2658 gdlr_core_ajax_action(ajax_section, name, value); 2659 }); 2660 2661 }); 2662 2663 } // gdlr_core_ajax 2664 $.fn.gdlr_core_ajax_slide_bar = function( filter_elem ){ 2665 if( typeof(filter_elem) == 'undefined' ){ 2666 var elem = $(this).find('[data-ajax]'); 2667 }else{ 2668 var elem = filter_elem.filter('[data-ajax]'); 2669 } 2670 2671 elem.each(function(){ 2672 2673 var ajax_section = $(this); 2674 2675 // filter slide bar 2676 $(this).children('.gdlr-core-filterer-slide-bar').each(function(){ 2677 var slide_bar = $(this); 2678 var active_slide = slide_bar.siblings('.gdlr-core-active'); 2679 slide_bar.css({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) }); 2680 2681 $(window).on('load resize', function(){ 2682 active_slide = slide_bar.siblings('.gdlr-core-active'); 2683 slide_bar.css({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) }); 2684 }); 2685 2686 ajax_section.find('a').hover(function(){ 2687 slide_bar.animate({'width': $(this).outerWidth(), 'left': $(this).position().left + parseInt($(this).css('margin-left')) }, {queue: false, duration: 200}); 2688 }, function(){ 2689 active_slide = slide_bar.siblings('.gdlr-core-active'); 2690 slide_bar.animate({'width': active_slide.outerWidth(), 'left': active_slide.position().left + parseInt(active_slide.css('margin-left')) }, {queue: false, duration: 200}); 2691 }); 2692 }); 2693 2694 }); 2695 } 2696 2697 $.fn.gdlr_core_dropdown_tab = function( filter_elem ){ 2698 2699 if( typeof(filter_elem) == 'undefined' ){ 2700 var elem = $(this).find('.gdlr-core-dropdown-tab'); 2701 }else{ 2702 var elem = filter_elem.filter('.gdlr-core-dropdown-tab'); 2703 } 2704 2705 elem.each(function(){ 2706 var tab_title = $(this).children('.gdlr-core-dropdown-tab-title'); 2707 var tab_title_text = tab_title.children('.gdlr-core-head'); 2708 var tab_dropdown = tab_title.children('.gdlr-core-dropdown-tab-head-wrap'); 2709 var tab_content = $(this).children('.gdlr-core-dropdown-tab-content-wrap'); 2710 2711 // dropdown 2712 tab_title.click(function(){ 2713 if( $(this).hasClass('gdlr-core-active') ){ 2714 $(this).removeClass('gdlr-core-active'); 2715 tab_dropdown.hide(); 2716 }else{ 2717 $(this).addClass('gdlr-core-active'); 2718 tab_dropdown.slideDown(200); 2719 } 2720 }); 2721 tab_dropdown.children().click(function(){ 2722 tab_title_text.html($(this).html()); 2723 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 2724 2725 var content_active = tab_content.children('[data-index="' + $(this).attr('data-index') + '"]'); 2726 content_active.fadeIn(200).addClass('gdlr-core-active'); 2727 content_active.siblings().hide().removeClass('gdlr-core-active'); 2728 }); 2729 2730 }); 2731 2732 } // gdlr_core_dropdown_tab 2733 2734 if( !gdlr_core_pbf.admin ){
2735 2736 $(document).ready(function(){ 2737 2738 var wpcf7_select = $('.wpcf7-form select'); 2739 if( wpcf7_select.length ){ 2740 $('<div class="wpcf7-form-indicator" ><i class="fa fa-angle-down" ></i></div>').insertAfter(wpcf7_select); 2741 } 2742 2743 $('body').each(function(){ 2744 2745 // turns image link to open in lightbox 2746 if( $(this).hasClass('gdlr-core-link-to-lightbox') ){ 2747 var image_link = $(this).find('a[href$=".jpg"], a[href$=".jpeg"], a[href$=".png"], a[href$=".gif"]') 2748 .not('.gdlr-core-ilightbox, .strip, [data-rel], .gdlr-core-lightgallery, .gdlr-core-social-share-pinterest') 2749 .addClass('strip gdlr-core-ilightbox gdlr-core-lightgallery').each(function(){ 2750 2751 if( $(this).closest('.gallery').length ){ 2752 var gallery_wrap = $(this).closest('.gallery'); 2753 if( gallery_wrap.attr('data-gallery-id') ){ 2754 var gallery_id = gallery_wrap.attr('data-gallery-id'); 2755 }else{ 2756 var gallery_id = Math.floor((Math.random() * 10000) + 1); 2757 gallery_wrap.attr('data-gallery-id', gallery_id); 2758 } 2759 2760 $(this).attr('data-ilightbox-group', 'wp-gallery-' + gallery_id); 2761 $(this).attr('data-lightbox-group', 'wp-gallery-' + gallery_id); 2762 $(this).attr('data-strip-group', 'wp-gallery-' + gallery_id); 2763 2764 } 2765 }); 2766 $(this).gdlr_core_lightbox( image_link ); 2767 } 2768 2769 var gdlr_core_js = $(this).find('.gdlr-core-js, iframe[src*="youtube"], iframe[src*="vimeo"]'); 2770 2771 // video resizing 2772 $(this).gdlr_core_content_script( gdlr_core_js, true ); 2773 2774 // hover box 2775 $(this).gdlr_core_hover_box( gdlr_core_js ); 2776 2777 // counter item 2778 $(this).gdlr_core_counter_item( gdlr_core_js ); 2779 2780 // type animation item 2781 $(this).gdlr_core_typed_animation( gdlr_core_js ); 2782 2783 // countdown item 2784 $(this).gdlr_core_countdown_item( gdlr_core_js ); 2785 2786 // alert box item 2787 $(this).gdlr_core_alert_box_item( gdlr_core_js ); 2788 2789 // accordion item 2790 $(this).gdlr_core_accordion( gdlr_core_js ); 2791 2792 // toggle box item 2793 $(this).gdlr_core_toggle_box( gdlr_core_js ); 2794 2795 // divider 2796 $(this).gdlr_core_divider( gdlr_core_js ); 2797 2798 // flipbox 2799 $(this).gdlr_core_flipbox( gdlr_core_js ); 2800 2801 // marquee 2802 $(this).gdlr_core_marquee( gdlr_core_js ); 2803 2804 // chart.js 2805 $(this).gdlr_core_chart_js( gdlr_core_js ); 2806 2807 // skill circle 2808 $(this).gdlr_core_skill_circle( gdlr_core_js ); 2809 2810 // skill bar 2811 $(this).gdlr_core_skill_bar( gdlr_core_js ); 2812 2813 // tab 2814 $(this).gdlr_core_tab( gdlr_core_js ); 2815 $(this).gdlr_core_price_table_tab( gdlr_core_js ); 2816 2817 // dropdown tab 2818 $(this).gdlr_core_dropdown_tab( gdlr_core_js ); 2819 2820 // lightbox 2821 $(this).gdlr_core_lightbox( gdlr_core_js ); 2822 2823 // ajax action 2824 $(this).gdlr_core_ajax( gdlr_core_js ); 2825 $(this).gdlr_core_ajax_slide_bar( gdlr_core_js ); 2826 2827 // sync height 2828 new gdlr_core_sync_height( $(this), gdlr_core_js ); 2829 2830 // set height 2831 new gdlr_core_set_full_height( $(this), gdlr_core_js ); 2832 2833 // sidebar wrapper height 2834 new gdlr_core_sidebar_wrapper( $(this), gdlr_core_js ); 2835 2836 // ux animation 2837 // $(this).gdlr_core_ux( gdlr_core_js ); 2838 new gdlr_core_ux( $(this), gdlr_core_js ); 2839 2840 // background parallax 2841 $(this).gdlr_core_parallax_background( gdlr_core_js ); 2842 2843 // particle 2844 $(this).gdlr_core_particle_background( gdlr_core_js ); 2845 2846 // price plan 2847 $('.gdlr-core-price-plan-item').each(function(){ 2848 var plan_options = $(this).children('.gdlr-core-price-plan-options'); 2849 var plan_forms = $(this).children('.gdlr-core-price-plan-forms'); 2850 2851 plan_options.find('.gdlr-core-active .gdlr-core-price-plan-content').css('display', 'block'); 2852 2853 plan_options.on('click', '.gdlr-core-price-plan', function(){ 2854 var price_plan = $(this); 2855 price_plan.find('.gdlr-core-price-plan-content').slideDown(150); 2856 price_plan.addClass('gdlr-core-active'); 2857 price_plan.siblings('.gdlr-core-active').find('.gdlr-core-price-plan-content').slideUp(1
285750); 2858 price_plan.siblings('.gdlr-core-active').removeClass('gdlr-core-active'); 2859 }); 2860 2861 $('.gdlr-core-price-plan-item').on('click', '.gdlr-core-step2', function(){ 2862 var selected_plan = parseInt($(this).siblings('.gdlr-core-price-plan.gdlr-core-active').attr('data-tab-id')) - 1; 2863 2864 plan_forms.children().css('display', 'none'); 2865 plan_forms.children().eq(selected_plan).css('display', 'block'); 2866 2867 plan_options.hide(); 2868 plan_forms.fadeIn(); 2869 }); 2870 2871 $('.gdlr-core-price-plan-forms').on('click', '.gdlr-core-step1', function(){ 2872 plan_options.fadeIn(); 2873 plan_forms.hide(); 2874 }); 2875 2876 }); 2877 2878 // custom dropdown 2879 gdlr_core_js.filter('.gdlr-core-custom-dropdown').each(function(){ 2880 var custom_dropdown = $(this); 2881 var dropdown_current = custom_dropdown.find('.gdlr-core-custom-dropdown-current'); 2882 2883 $(this).on('click', '.gdlr-core-custom-dropdown-current', function(){ 2884 dropdown_current.siblings('.gdlr-core-custom-dropdown-list').slideDown(150); 2885 }); 2886 $(document).click(function(e){ 2887 if( !$(e.target).is('.gdlr-core-custom-dropdown-current') ){ 2888 dropdown_current.siblings('.gdlr-core-custom-dropdown-list').slideUp(150, function(){ 2889 if( $(e.target).is('.gdlr-core-custom-dropdown-list-item') ){ 2890 $(e.target).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active') 2891 } 2892 }); 2893 if( $(e.target).is('.gdlr-core-custom-dropdown-list-item') ){ 2894 dropdown_current.html( $(e.target).html() ); 2895 } 2896 } 2897 }); 2898 }); 2899 2900 // privacy box cookie 2901 gdlr_core_js.filter('.gdlr-core-privacy-box-button').on('click', function(){ 2902 var privacy_box_wrap = $(this).closest('.gdlr-core-privacy-box-wrap'); 2903 if( privacy_box_wrap.is('.gdlr-core-pos-bottom-bar, .gdlr-core-pos-top-bar') ){ 2904 privacy_box_wrap.slideUp(200); 2905 }else{ 2906 privacy_box_wrap.fadeOut(250); 2907 } 2908 2909 var cookie_time = $(this).attr('data-cookie-time')? $(this).attr('data-cookie-time'): 2592000; 2910 gdlr_core_set_cookie('gdlr-core-privacy-box', 1, cookie_time); 2911 2912 window.location.reload(); 2913 2914 return false; 2915 }); 2916 2917 // gdlr lightbox 2918 gdlr_core_js.filter('[data-gdlr-lb]').each(function(){ 2919 var lb_wrap = $('#' + $(this).data('gdlr-lb')); 2920 if( lb_wrap.length ){ 2921 2922 // open lightbox action 2923 $(this).on('click', function(){ 2924 lb_wrap.fadeIn(200); 2925 return false; 2926 }); 2927 2928 // bind the lightbox close action 2929 lb_wrap.find('.gdlr-core-lightbox-form-close').on('click', function(){ 2930 $(this).closest('.gdlr-core-lightbox-wrapper').fadeOut(); 2931 return false; 2932 }); 2933 } 2934 }); 2935 2936 // gdpr form 2937 gdlr_core_js.filter('#gdlr-core-gdpr-form').each(function(){ 2938 2939 // change tab 2940 $(this).on('click', '.gdlr-core-gdlr-form-nav li', function(){ 2941 $(this).addClass('gdlr-core-active').siblings().removeClass('gdlr-core-active'); 2942 2943 var nav_id = $(this).data('gdlr-nav'); 2944 var content_wrap = $(this).closest('.gdlr-core-gdpr-form-left').siblings('.gdlr-core-gdpr-form-right'); 2945 content_wrap.find('[data-gdlr-nav="' + nav_id + '"]').each(function(){ 2946 $(this).siblings('[data-gdlr-nav]').removeClass('gdlr-core-active').css('display', 'none'); 2947 $(this).fadeIn(200, function(){ $(this).addClass('gdlr-core-active'); }); 2948 }); 2949 }); 2950 }); 2951 2952 // sticky sidebar 2953 new gdlr_core_sticky_sidebar(gdlr_core_js); 2954 }); 2955 2956 }); // document.ready 2957 2958 $(window).on('load', function(){ 2959 2960 $('body').each(function(){ 2961 2962 var gdlr_core_js = $(this).find('.gdlr-core-js-2'); 2963 2964 // title divider 2965 $(this).gdlr_core_title_divider( gdlr_core_js ); 2966 2967 // flexslider 2968 $(this).gdlr_core_flexslider( gdlr_core_js ); 2969 2970 // sly slider 2971 $(this).gdlr_core_sly( gdlr_core_js ); 2972 2973 // isotope 2974 $(this).gdlr_core_isotope( gdlr_core_js ); 2975 2976 }); 2977 2978 }); // window.load 2979 2980 } 2981 2982})(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.