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