1(function($){ 2 "use strict"; 3 4 if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || 5 navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || 6 navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || 7 navigator.userAgent.match(/Windows Phone/i) ){ 8 var gdlr_touch_device = true; 9 }else{ 10 var gdlr_touch_device = false; 11 } 12 13 // retrieve GET variable from url 14 $.extend({ 15 getUrlVars: function(){ 16 var vars = [], hash; 17 var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); 18 for(var i = 0; i < hashes.length; i++) 19 { 20 hash = hashes[i].split('='); 21 vars.push(hash[0]); 22 vars[hash[0]] = hash[1]; 23 } 24 return vars; 25 }, 26 getUrlVar: function(name){ 27 return $.getUrlVars()[name]; 28 } 29 }); 30 31 // blog - port nav 32 function gdlr_set_item_outer_nav(){ 33 $('.blog-item-wrapper > .gdlr-nav-container').each(function(){ 34 var container = $(this).siblings('.blog-item-holder'); 35 var child = $(this).children(); 36 child.css({ 'top':container.position().top, 'bottom':'auto', height: container.height() - 50 }); 37 }); 38 $('.portfolio-item-wrapper > .gdlr-nav-container').each(function(){ 39 var container = $(this).siblings('.portfolio-item-holder'); 40 var child = $(this).children(); 41 child.css({ 'top':container.position().top, 'bottom':'auto', height: container.height() - 40 }); 42 }); 43 } 44 45 // runs flex slider function 46 $.fn.gdlr_flexslider = function(){ 47 if(typeof($.fn.thekeynote_flexslider) == 'function'){ 48 $(this).each(function(){ 49 var flex_attr = { 50 animation: 'fade', 51 animationLoop: true, 52 prevText: '<i class="icon-angle-left" ></i>', 53 nextText: '<i class="icon-angle-right" ></i>', 54 useCSS: false 55 }; 56 57 // slide duration 58 if( $(this).attr('data-pausetime') ){ 59 flex_attr.slideshowSpeed = parseInt($(this).attr('data-pausetime')); 60 } 61 if( $(this).attr('data-slidespeed') ){ 62 flex_attr.animationSpeed = parseInt($(this).attr('data-slidespeed')); 63 } 64 65 // set the attribute for carousel type 66 if( $(this).attr('data-type') == 'carousel' ){ 67 flex_attr.move = 1; 68 flex_attr.animation = 'slide'; 69 70 if( $(this).closest('.gdlr-item-no-space').length > 0 ){ 71 flex_attr.itemWidth = $(this).width() / parseInt($(this).attr('data-columns')); 72 flex_attr.itemMargin = 0; 73 }else{ 74 flex_attr.itemWidth = (($(this).width() + 30) / parseInt($(this).attr('data-columns'))) - 30; 75 flex_attr.itemMargin = 30; 76 } 77 78 // if( $(this).attr('data-columns') == "1" ){ flex_attr.smoothHeight = true; } 79 }else{ 80 if( $(this).attr('data-effect') ){ 81 flex_attr.animation = $(this).attr('data-effect'); 82 } 83 } 84 if( $(this).attr('data-columns') ){ 85 flex_attr.minItems = parseInt($(this).attr('data-columns')); 86 flex_attr.maxItems = parseInt($(this).attr('data-columns')); 87 } 88 89 // set the navigation to different area 90 if( $(this).attr('data-nav-container') ){ 91 var flex_parent = $(this).parents('.' + $(this).attr('data-nav-container')).prev('.gdlr-nav-container'); 92 93 if( flex_parent.find('.gdlr-flex-prev').length > 0 || flex_parent.find('.gdlr-flex-next').length > 0 ){ 94 flex_attr.controlNav = false; 95 flex_attr.directionNav = false;
96 flex_attr.start = function(slider){ 97 flex_parent.find('.gdlr-flex-next').click(function(){ 98 slider.flexAnimate(slider.getTarget("next"), true); 99 }); 100 flex_parent.find('.gdlr-flex-prev').click(function(){ 101 slider.flexAnimate(slider.getTarget("prev"), true); 102 }); 103 104 gdlr_set_item_outer_nav(); 105 $(window).resize(function(){ gdlr_set_item_outer_nav(); }); 106 } 107 }else{ 108 flex_attr.controlNav = false; 109 flex_attr.controlsContainer = flex_parent.find('.nav-container'); 110 } 111 112 } 113 114 $(this).thekeynote_flexslider(flex_attr); 115 }); 116 } 117 } 118 119 // runs nivo slider function 120 $.fn.gdlr_nivoslider = function(){ 121 if(typeof($.fn.nivoSlider) == 'function'){ 122 $(this).each(function(){ 123 var nivo_attr = {}; 124 125 if( $(this).attr('data-pausetime') ){ 126 nivo_attr.pauseTime = parseInt($(this).attr('data-pausetime')); 127 } 128 if( $(this).attr('data-slidespeed') ){ 129 nivo_attr.animSpeed = parseInt($(this).attr('data-slidespeed')); 130 } 131 if( $(this).attr('data-effect') ){ 132 nivo_attr.effect = $(this).attr('data-effect'); 133 } 134 135 $(this).nivoSlider(nivo_attr); 136 }); 137 } 138 } 139 140 // runs isotope function 141 $.fn.gdlr_isotope = function(){ 142 if(typeof($.fn.isotope) == 'function'){ 143 $(this).each(function(){ 144 var layout = ($(this).attr('data-layout'))? $(this).attr('data-layout'): 'fitRows'; 145 if( layout == 'fitRows' ) return; 146 147 // execute isotope 148 var isotope_element = $(this); 149 isotope_element.children('.clear').remove(); 150 isotope_element.isotope({ 151 layoutMode: layout 152 }); 153 154 // resize event 155 $(window).resize(function(){ 156 isotope_element.isotope(); 157 }); 158 }); 159 } 160 } 161 162 // runs fancybox function 163 $.fn.gdlr_fancybox = function(){ 164 if(typeof($.fn.fancybox) == 'function'){ 165 var fancybox_attr = { 166 nextMethod : 'resizeIn', 167 nextSpeed : 250, 168 prevMethod : false, 169 prevSpeed : 250, 170 helpers : { media : {} } 171 }; 172 173 if( typeof($.fancybox.helpers.thumbs) == 'object' ){ 174 fancybox_attr.helpers.thumbs = { width: 50, height: 50 }; 175 } 176 177 $(this).fancybox(fancybox_attr); 178 } 179 } 180 181 // responsive video 182 $.fn.gdlr_fluid_video = function(){ 183 $(this).find('iframe[src*="youtube"], iframe[src*="vimeo"]').each(function(){ 184 185 // ignore if inside layerslider 186 if( $(this).closest('.ls-container, .master-slider').length <= 0 ){ 187 if( ($(this).is('embed') && $(this).parent('object').length) || $(this).parent('.fluid-width-video-wrapper').length ){ return; } 188 if( !$(this).attr('id') ){ $(this).attr('id', 'gdlr-video-' + Math.floor(Math.random()*999999)); } 189 190 var ratio = $(this).height() / $(this).width(); 191 $(this).removeAttr('height').removeAttr('width'); 192 try{
193 $(this).wrap('<div class="gdlr-fluid-video-wrapper"></div>').parent().css('padding-top', (ratio * 100)+"%"); 194 }catch(e){ 195 } 196 } 197 198 }); 199 } 200 201 // pie chart 202 $.fn.gdlr_pie_chart = function(){ 203 if(typeof($.fn.easyPieChart) == 'function'){ 204 $(this).each(function(){ 205 var gdlr_chart = $(this); 206 207 $(this).easyPieChart({ 208 animate: 1200, 209 lineWidth: gdlr_chart.attr('data-linewidth')? parseInt(gdlr_chart.attr('data-linewidth')): 8, 210 size: gdlr_chart.attr('data-size')? parseInt(gdlr_chart.attr('data-size')): 155, 211 barColor: gdlr_chart.attr('data-color')? gdlr_chart.attr('data-color'): '#a9e16e', 212 trackColor: gdlr_chart.attr('data-bg-color')? gdlr_chart.attr('data-bg-color'): '#f2f2f2', 213 backgroundColor: gdlr_chart.attr('data-background'), 214 scaleColor: false, 215 lineCap: 'square' 216 }); 217 218 // for responsive purpose 219 function limit_gdlr_chart_size(){ 220 if( gdlr_chart.parent().width() < parseInt(gdlr_chart.attr('data-size')) ){ 221 var max_width = gdlr_chart.parent().width() + 'px'; 222 gdlr_chart.css({'max-width': max_width, 'max-height': max_width}); 223 } 224 } 225 limit_gdlr_chart_size(); 226 $(window).resize(function(){ limit_gdlr_chart_size(); }); 227 }); 228 } 229 } 230 231 $(document).ready(function(){ 232 233 // video responsive 234 $('body').gdlr_fluid_video(); 235 236 // top woocommerce button 237 $('.gdlr-top-woocommerce-wrapper').hover(function(){ 238 $(this).children('.gdlr-top-woocommerce').fadeIn(200); 239 }, function(){ 240 $(this).children('.gdlr-top-woocommerce').fadeOut(200); 241 }); 242 243 // script for accordion item 244 $('.gdlr-accordion-item').each(function(){ 245 var multiple_tab = $(this).hasClass('gdlr-multiple-tab'); 246 $(this).children('.accordion-tab').children('.accordion-title').click(function(){ 247 var current_tab = $(this).parent(); 248 if( current_tab.hasClass('active') ){ 249 current_tab.removeClass('pre-active'); 250 $(this).children('i').removeClass('icon-minus').addClass('icon-plus'); 251 $(this).siblings('.accordion-content').slideUp(function(){ current_tab.removeClass('active'); }); 252 }else{ 253 current_tab.addClass('pre-active'); 254 $(this).children('i').removeClass('icon-plus').addClass('icon-minus'); 255 $(this).siblings('.accordion-content').slideDown(function(){ current_tab.addClass('active'); }); 256 257 } 258 259 // close another tab if multiple tab is not allowed ( accordion ) 260 if( !multiple_tab ){ 261 current_tab.siblings().removeClass('pre-active'); 262 current_tab.siblings().children('.accordion-title').children('i').removeClass('icon-minus').addClass('icon-plus'); 263 current_tab.siblings().children('.accordion-content').slideUp(function(){ $(this).parent().removeClass('active'); }); 264 } 265 }); 266 }); 267 268 // script for tab item 269 $('.tab-title-wrapper').children().click(function(){ 270 $(this).addClass('active'); 271 $(this).siblings().removeClass('active'); 272 273 var selected_index = $(this).index() + 1; 274 $(this).parent().siblings('.tab-content-wrapper').children(':nth-child(' + selected_index + ')').each(function(){ 275 $(this).siblings().removeClass('active').hide(); 276 $(this).fadeIn(function(){ $(this).addClass('active'); }); 277 }) 278 }); 279 280 // paypal form 281 jQuery('.gdlr-paypal-form').each(function(){ 282 var gdlr_form = jQuery(this); 283 284 jQuery(this).on('change', 'select[name="quantity"]', function(){ 285 var total_price = gdlr_form.find('.gdlr-total-price'); 286 var price = parseFloat(total_price.siblings('.gdlr-price-one').val()) * parseInt(jQuery(this).val()); 287 total_price.val(price); 288 }); 289 290 jQuery(this).children('.gdlr-button-mail, .gdlr-button-paypal').click(function(){ 291 var valid = true; 292 var paypal_redirect = true; 293 294 if( jQuery(this).hasClass('gdlr-button-paypal') ){ 295 jQuery(this).siblings('.gdlr-paypal-action').attr('value', 'save_paypal_form'); 296 }else{ 297 paypal_redirect = false; 298 jQuery(this).siblings('.gdlr-paypal-action').attr('value', 'send_contact_form_mail'); 299 } 300 301 // check require fields 302 gdlr_form.find('.gdlr-require').each(function(){ 303 if( valid && jQuery(this).val() == '' ){ 304 gdlr_form.children('.gdlr-notice.require-field').slideDown(200) 305 .siblings('.gdlr-notice').slideUp(200); 306 valid = false;
307 } 308 }); 309 310 // check email 311 gdlr_form.find('.gdlr-email').each(function(){ 312 var re = /\S+@\S+/; 313 if( valid && !re.test(jQuery(this).val()) ){ 314 gdlr_form.children('.gdlr-notice.email-invalid').slideDown(200) 315 .siblings('.gdlr-notice').slideUp(200); 316 valid = false; 317 } 318 }); 319 320 if( valid ){ 321 gdlr_form.children('.gdlr-notice').slideUp(200); 322 gdlr_form.children('.gdlr-paypal-loader').slideDown(200); 323 324 var ajax_url = gdlr_form.attr('data-ajax'); 325 jQuery.ajax({ 326 type: 'POST', 327 url: ajax_url, 328 data: gdlr_form.serialize(), 329 dataType: 'json', 330 error: function(a, b, c){ 331 console.log(a, b, c); 332 }, 333 success: function(data){ 334 gdlr_form.children('.gdlr-notice.alert-message') 335 .html(data.message).slideDown(200).addClass('gdlr-' + data.status); 336 gdlr_form.children('.gdlr-paypal-loader').slideUp(200); 337 338 if( data.status == 'success' && paypal_redirect ){ 339 gdlr_form.children('[name="invoice"]').val(data.invoice); 340 gdlr_form.children('[name="amount"]').val(data.amount); 341 gdlr_form[0].submit(); 342 }else{ 343 if( data.log ){ 344 console.log(data.log); 345 } 346 } 347 } 348 }); 349 } 350 }); 351 }); 352 353 // script for session tab item 354 $('.gdlr-session-item-head-info').click(function(){ 355 if( $(this).hasClass('gdlr-active') ) return; 356 $(this).siblings().removeClass('gdlr-active'); 357 $(this).addClass('gdlr-active'); 358 359 var selected_tab = $(this).attr('data-tab'); 360 $(this).parent('.gdlr-session-item-head').siblings('.gdlr-session-item-tab-content').hide(); 361 $(this).parent('.gdlr-session-item-head').siblings('.' + selected_tab).fadeIn(); 362 }); 363 364 // script for session counter item 365 $('.gdlr-session-counter-item').each(function(){ 366 var day_field = $(this).find('.gdlr-day'); 367 var day = parseInt(day_field.text()); 368 369 var hrs_field = $(this).find('.gdlr-hrs'); 370 var hrs = parseInt(hrs_field.text()); 371 372 var min_field = $(this).find('.gdlr-min'); 373 var min = parseInt(min_field.text()); 374 375 var sec_field = $(this).find('.gdlr-sec'); 376 var sec = parseInt(sec_field.text()); 377 378 var i = setInterval(function(){ 379 if( sec > 0 ){ 380 sec--; 381 }else{ 382 sec = 59; 383 if( min > 0 ){ 384 min--; 385 }else{ 386 min = 59; 387 if( hrs > 0 ){ 388 hrs--; 389 }else{ 390 hrs = 24; 391 if( day > 0 ){ 392 day--; 393 }else{ 394 day = 0; 395 hrs = 0; 396 min = 0; 397 sec = 0; 398 clearInterval(i); 399 } 400 day_field.text(day); 401 } 402 hrs_field.text(hrs); 403 } 404 min_field.text(min); 405 } 406 sec_field.text(sec); 407 }, 1000); 408 }); 409 410 // initiate the tab when the get tab variable is sent 411 var inital_tab = $.getUrlVar('tab'); 412 if( inital_tab ){ $('#' + inital_tab.replace(',', ', #')).each(function(){ $(this).trigger('click'); }); } 413 414 // script for code item 415 $('.gdlr-code-item .gdlr-code-title').click(function(){ 416 var parent = $(this).parent(); 417 if( parent.hasClass('active') ){ 418 $(this).children('i').removeClass('icon-minus').addClass('icon-plus'); 419 $(this).siblings('.gdlr-code-content').slideUp(function(){ 420 parent.removeClass('active'); 421 }); 422 }else{ 423 $(this).children('i').removeClass('icon-plus').addClass('icon-minus'); 424 $(this).siblings('.gdlr-code-content').slideDown(function(){ 425 parent.addClass('active'); 426 }); 427 } 428 }); 429 430 // script for parallax background 431 $('.gdlr-parallax-wrapper').each(function(){ 432 if( $(this).hasClass('gdlr-background-image') || $(this).hasClass('gdlr-page-title-wrapper') ){ 433 var parallax_section = $(this); 434 var parallax_speed = parseFloat(parallax_section.attr('data-bgspeed')); 435 if( parallax_speed == 0 || gdlr_touch_device ) return; 436 if( parallax_speed == -1 ){ 437 parallax_section.css('background-attachment', 'fixed'); 438 parallax_section.css('background-position', 'center center'); 439 return; 440 } 441 442 $(window).scroll(function(){ 443 // if in area of interest 444 if( ( $(window).scrollTop() + $(window).height() > parallax_section.offset().top ) && 445 ( $(window).scrollTop() < parallax_section.offset().top + parallax_section.outerHeight() ) ){ 446 447 var scroll_pos = 0; 448 if( $(window).height() > parallax_section.offset().top ){ 449 scroll_pos = $(window).scrollTop(); 450 }else{ 451 scroll_pos = $(window).scrollTop() + $(window).height() - parallax_section.offset().top; 452 } 453 parallax_section.css('background-position', 'center ' + (-scroll_pos * parallax_speed) + 'px'); 454 } 455 }); 456 }else if( $(this).hasClass('gdlr-background-video') ){ 457 if(typeof($.fn.mb_YTPlayer) == 'function'){ 458 $(this).children('.gdlr-bg-player').mb_YTPlayer(); 459 } 460 }else{ 461 return; 462 } 463 }); 464 465 // runs superfish menu 466 if(typeof($.fn.superfish) == 'function'){ 467 468 // create the mega menu script 469 $('#gdlr-main-navigation .sf-mega > ul').each(function(){ 470 $(this).children('li').each(function(){ 471 var current_item = $(this); 472 current_item.replaceWith( 473 $('<div />').addClass('sf-mega-section') 474 .addClass(current_item.attr('data-column')) 475 .attr('data-size', current_item.attr('data-size')) 476 .html( $('<div />').addClass('sf-mega-section-inner') 477 .addClass(current_item.attr('class')) 478 .attr('id', current_item.attr('id')) 479 .html(current_item.html()) 480 ) 481 ); 482 }); 483 $(this).replaceWith(this.innerHTML); 484 }); 485 486 // make every menu same height 487 $('#gdlr-main-navigation .sf-mega').each(function(){ 488 var sf_mega = $(this); $(this).show(); 489 490 var row = 0; var column = 0; var max_height = 0; 491 sf_mega.children('.sf-mega-section').each(function(){ 492 if( column % 60 == 0 ){ 493 if( row != 0 ){ 494 sf_mega.children('[data-row="' + row + '"]').children('.sf-mega-section-inner').height( max_height - 50 ); 495 max_height = 0; 496 } 497 row++; $(this).addClass('first-column'); 498 } 499 500 $(this).attr('data-row', row); 501 column += eval('60*' + $(this).attr('data-size')); 502 503 if( $(this).height() > max_height ){ 504 max_height = $(this).height(); 505 } 506 }); 507 508 sf_mega.children('[data-row="' + row + '"]').children('.sf-mega-section-inner').height( max_height - 50 ); 509 }); 510 511 $('#gdlr-main-navigation').superfish({ 512 speed: 'fast' 513 }); 514 } 515 516 // responsive menu 517 if(typeof($.fn.dlmenu) == 'function'){ 518 $('#gdlr-responsive-navigation').each(function(){ 519 $(this).find('.dl-submenu').each(function(){ 520 if( $(this).siblings('a').attr('href') && $(this).siblings('a').attr('href') != '#' ){ 521 var parent_nav = $('<li class="menu-item gdlr-parent-menu"></li>'); 522 parent_nav.append($(this).siblings('a').clone()); 523 524 $(this).prepend(parent_nav); 525 } 526 }); 527 $(this).dlmenu(); 528 }); 529 } 530 531 // gallery thumbnail type
532 $('.gdlr-gallery-thumbnail').each(function(){ 533 var thumbnail_container = $(this).children('.gdlr-gallery-thumbnail-container'); 534 535 $(this).find('.gallery-item').click(function(){ 536 var selected_slide = thumbnail_container.children('[data-id="' + $(this).attr('data-id') + '"]'); 537 if(selected_slide.css('display') == 'block') return false; 538 539 // check the gallery height 540 var image_width = selected_slide.children('img').attr('width'); 541 var image_ratio = selected_slide.children('img').attr('height') / image_width; 542 var temp_height = image_ratio * Math.min(thumbnail_container.width(), image_width); 543 544 thumbnail_container.animate({'height': temp_height}); 545 selected_slide.fadeIn().siblings().hide(); 546 return false; 547 }); 548 549 $(window).resize(function(){ thumbnail_container.css('height', 'auto') }); 550 }); 551 552 // fancybox 553 $('a[href$=".jpg"], a[href$=".png"], a[href$=".gif"]').not('[data-rel="fancybox"], [href*="pinterest"]').attr('data-rel', 'fancybox'); 554 $('[data-rel="fancybox"]').gdlr_fancybox(); 555 556 // image shortcode
557 $('.gdlr-image-link-shortcode').hover(function(){ 558 $(this).find('.gdlr-image-link-overlay').animate({opacity: 0.8}, 150); 559 $(this).find('.gdlr-image-link-icon').animate({opacity: 1}, 150); 560 }, function(){ 561 $(this).find('.gdlr-image-link-overlay').animate({opacity: 0}, 150); 562 $(this).find('.gdlr-image-link-icon').animate({opacity: 0}, 150); 563 }); 564 565 // Personnel 566 $('.gdlr-personnel-item.round-style .personnel-item').each(function(){ 567 var current_item = $(this); 568 function gdlr_set_round_personnel_height(){ 569 current_item.find('.personnel-item-inner').each(function(){ 570 $(this).css('margin-top', -($(this).height()/2)); 571 }); 572 } 573 574 gdlr_set_round_personnel_height(); 575 $(window).resize(function(){ 576 gdlr_set_round_personnel_height(); 577 }); 578 }); 579 $('.gdlr-personnel-item.round-style .personnel-item').hover(function(){ 580 $(this).find('.personnel-author-image').animate({'opacity':0.05}, 200); 581 $(this).find('.personnel-item-inner').animate({'opacity':1}, 200); 582 }, function(){ 583 $(this).find('.personnel-author-image').animate({'opacity':1}, 200); 584 $(this).find('.personnel-item-inner').animate({'opacity':0}, 200); 585 }); 586 587 // Price Table 588 $('.gdlr-price-table-item').each(function(){ 589 var price_table = $(this); 590 591 function set_price_table_height(){ 592 var max_height = 0; 593 var price_content = price_table.find('.price-content'); 594 595 price_content.css('height', 'auto'); 596 price_content.each(function(){ 597 if( max_height < $(this).height() ){ max_height = $(this).height(); } 598 }); 599 price_content.css('height', max_height); 600 } 601 602 set_price_table_height() 603 $(window).resize(function(){ set_price_table_height(); }); 604 }); 605 606 // Default text 607 $('form').submit(function(){ 608 var has_default = false;
609 $(this).find('input[data-default]').each(function(){ 610 if( $(this).is('#url') ){ 611 if( $(this).val() == $(this).attr('data-default') ) $(this).val(''); 612 }else{ 613 if( $(this).val() == $(this).attr('data-default') ) has_default = true; 614 } 615 }); 616 617 if(has_default) return false; 618 }); 619 620 // Search option 621 $('#gdlr-menu-search-button').click(function(){ 622 $(this).siblings('#gdlr-menu-search').slideToggle(200); 623 }); 624 $('.search-text input[data-default], .gdlr-comments-area input[data-default]').each(function(){ 625 var default_value = $(this).attr("data-default"); 626 $(this).val(default_value); 627 $(this).on("blur", function(){ 628 if ($(this).val() == ""){ 629 $(this).val(default_value); 630 } 631 }).on("focus", function(){ 632 if ($(this).val() == default_value){ 633 $(this).val(""); 634 } 635 }); 636 }); 637 638 // smooth anchor 639 if( window.location.hash ){ // if hash in url 640 if( $(""+window.location.hash) ){ // if element with this id exist 641 $(window).load(function(){ 642 $('html, body').animate({ 643 scrollTop: $(window.location.hash).offset().top - 65 644 }, 500); 645 }); 646 } 647 } 648 $('.gdlr-navigation a[href*="#"], .gdlr-responsive-navigation a[href*="#"]').click(function(){ 649 if( $(this).attr('href').length > 1 ){ 650 var item_id = $(this.hash); 651 652 if( item_id.length > 0 || $('body').hasClass('home') ){ 653 $('html, body').animate({ 654 scrollTop: item_id.offset().top - 65 655 }, 500); 656 return false; 657 }else{ 658 window.location.replace($('.body-wrapper').attr('data-home') + '/' + this.hash); 659 } 660 } 661 }); 662 663 // animate ux 664 if( !gdlr_touch_device ){ 665 666 // image ux 667 $('.content-wrapper img').each(function(){ 668 if( $(this).closest('.gdlr-ux, .ls-wp-container, .product, .flexslider, .nivoSlider').length ) return; 669 670 var ux_item = $(this); 671 if( ux_item.offset().top > $(window).scrollTop() + $(window).height() ){ 672 ux_item.css({ 'opacity':0 }); 673 }else{ return; } 674 675 $(window).scroll(function(){ 676 if( $(window).scrollTop() + $(window).height() > ux_item.offset().top + 100 ){ 677 ux_item.animate({ 'opacity':1 }, 1200); 678 } 679 }); 680 }); 681 682 // item ux 683 $('.gdlr-ux').each(function(){ 684 var ux_item = $(this); 685 if( ux_item.hasClass('gdlr-chart') || ux_item.hasClass('gdlr-skill-bar') ){ 686 if( ux_item.offset().top < $(window).scrollTop() + $(window).height() ){ 687 if( ux_item.hasClass('gdlr-chart') ){ 688 ux_item.gdlr_pie_chart(); 689 }else if( ux_item.hasClass('gdlr-skill-bar') ){ 690 ux_item.children('.gdlr-skill-bar-progress').each(function(){ 691 if($(this).attr('data-percent')){ 692 $(this).animate({width: $(this).attr('data-percent') + '%'}, 1200, 'easeOutQuart'); 693 } 694 }); 695 } 696 return; 697 } 698 }else if( ux_item.offset().top > $(window).scrollTop() + $(window).height() ){ 699 ux_item.css({ 'opacity':0, 'padding-top':20, 'margin-bottom':-20 }); 700 }else{ return; } 701 702 $(window).scroll(function(){ 703 if( $(window).scrollTop() + $(window).height() > ux_item.offset().top + 100 ){ 704 if( ux_item.hasClass('gdlr-chart') ){ 705 ux_item.gdlr_pie_chart(); 706 }else if( ux_item.hasClass('gdlr-skill-bar') ){ 707 ux_item.children('.gdlr-skill-bar-progress').each(function(){ 708 if($(this).attr('data-percent')){ 709 $(this).animate({width: $(this).attr('data-percent') + '%'}, 1200, 'easeOutQuart'); 710 } 711 }); 712 }else{ 713 ux_item.animate({ 'opacity':1, 'padding-top':0, 'margin-bottom':0 }, 1200); 714 } 715 } 716 }); 717 }); 718 719 // do not animate on scroll in mobile 720 }else{ 721 722 // Pie chart 723 $('.gdlr-chart').gdlr_pie_chart(); 724 725 726 // skill bar 727 $('.gdlr-skill-bar-progress').each(function(){ 728 if($(this).attr('data-percent')){ 729 $(this).animate({width: $(this).attr('data-percent') + '%'}, 1200, 'easeOutQuart'); 730 } 731 }); 732 } 733 734 // runs nivoslider when available 735 $('.nivoSlider').gdlr_nivoslider(); 736 737 // runs flexslider when available 738 $('.flexslider').gdlr_flexslider(); 739 740 }); 741 742 $(window).load(function(){ 743 744 // run isotope when available 745 $('.gdlr-isotope').gdlr_isotope(); 746 747 // sliding nav 748 if( !gdlr_touch_device ){ 749 var slide_nav = $('#gdlr-navigation-gimmick'); 750 var current_pos = 0; 751 var current_menu_width = 0; 752 753 754 // init menu width 755 $('#gdlr-main-navigation > ul > li.current-menu-item, #gdlr-main-navigation > ul > li.current-menu-ancestor, #gdlr-main-navigation > ul > li.current_page_item, #gdlr-main-navigation > ul > li.current_page_ancestor').each(function(){ 756 var padding = parseInt( $(this).css('padding-right') ); 757 current_pos = $(this).position().left + padding; 758 current_menu_width = $(this).width(); 759 760 slide_nav.css({'width': current_menu_width, 'left': current_pos}); 761 }); 762 if( current_pos == 0 ){ 763 current_pos = $('#gdlr-main-navigation').position().left; 764 slide_nav.css('left', current_pos); 765 } 766 767 $('.gdlr-navigation a[href*="#"], .gdlr-responsive-navigation a[href*="#"]').click(function(){ 768 var padding = parseInt( $(this).parent().css('padding-left') ); 769 current_pos = $(this).parent().position().left + padding; 770 current_menu_width = $(this).parent().width(); 771 }); 772 773 $(window).resize(function(){ 774 // init menu width 775 $('#gdlr-main-navigation > ul > li.current-menu-item, #gdlr-main-navigation > ul > li.current-menu-ancestor, #gdlr-main-navigation > ul > li.current_page_item, #gdlr-main-navigation > ul > li.current_page_ancestor').each(function(){ 776 var padding = parseInt( $(this).css('padding-left') ); 777 current_pos = $(this).position().left + padding; 778 current_menu_width = $(this).width(); 779 780 slide_nav.css({'width': current_menu_width, 'left': current_pos}); 781 }); 782 if( current_pos == 0 ){ 783 current_pos = $('#gdlr-main-navigation').position().left; 784 slide_nav.css('left', current_pos); 785 } 786 }); 787 788 $('#gdlr-main-navigation > ul > li').hover(function(){ 789 var padding = parseInt( $(this).css('padding-left') ); 790 791 slide_nav.animate({ 'width': jQuery(this).width(), 'left': jQuery(this).position().left + padding}, 792 { queue: false, easing: 'easeOutQuad', duration: 250 }); 793 }, function(){ 794 slide_nav.animate({ 'width': current_menu_width, 'left': current_pos }, 795 { queue: false, easing: 'easeOutQuad', duration: 250 }); 796 }); 797 } 798 799 // float menu 800 $('.body-wrapper.float-menu').each(function(){
801 var sub_area = $('#gdlr-header-substitute'); 802 var main_area = sub_area.siblings('.gdlr-header-wrapper'); 803 804 var logo = main_area.find('.gdlr-logo'); 805 var logo_img = main_area.find('.gdlr-logo img'); 806 var navigation = main_area.find('.gdlr-navigation-wrapper'); 807 var original = { 808 logo_top: logo.css('margin-top'), 809 logo_bottom: logo.css('margin-bottom'), 810 nav_top: navigation.css('margin-top') 811 }; 812 813 $(window).scroll(function(){ 814 if( main_area.hasClass('gdlr-fixed-header') && ($(this).scrollTop() == 0 || $(this).width() < 959)){ 815 main_area.children('.top-navigation-wrapper').slideDown(100); 816 817 logo.animate({'margin-top': original.logo_top, 'margin-bottom': original.logo_bottom}, {duration: 100, queue: false}); 818 if( logo_img.length ){ 819 logo_img.animate({'width': '100%'}, {duration: 100, queue: false, complete: function(){ 820 main_area.removeClass('gdlr-fixed-header'); 821 sub_area.css('height', 'auto'); 822 }}); 823 }else{ 824 main_area.removeClass('gdlr-fixed-header'); 825 sub_area.css('height', 'auto'); 826 } 827 828 navigation.animate({'margin-top': original.nav_top}, {duration: 100, queue: false}); 829 }else if( !main_area.hasClass('gdlr-fixed-header') && $(this).width() > 959 && 830 $(this).scrollTop() > main_area.children('.gdlr-header-inner').offset().top - parseInt($('html').css('margin-top')) ){ 831 832 sub_area.css('height', main_area.height()); 833 834 main_area.addClass('gdlr-fixed-header'); 835 main_area.children('.top-navigation-wrapper').hide(); 836 837 logo.animate({'margin-top': '20', 'margin-bottom': '23'}, {duration: 100, queue: false}); 838 logo_img.animate({'width': '80%'}, {duration: 0, queue: false}); 839 navigation.animate({'margin-top': '21'}, {duration: 100, queue: false}); 840 } 841 }); 842 }); 843 844 $(window).trigger('resize'); 845 $(window).trigger('scroll'); 846 }); 847 848})(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.