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