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