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