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