1/** 2/** 3 * Wordpress Front End Enhancements. 4 * 5 * jQuery effects used in theme. 6 */ 7 8/* ---------------------------------------------------------------------------------- 9 FORMAT FOOTER LAYOUT 10---------------------------------------------------------------------------------- */ 11jQuery(document).ready(function(){ 12 13 jQuery('#footer-core .widget-area:last-child').addClass("last"); 14 15 /* Footer - Footer Widgets Layout (Options 1 - 6) */ 16 jQuery('#footer-core.option2 .widget-area').addClass("one_half"); 17 jQuery('#footer-core.option3 .widget-area').addClass("one_third"); 18 jQuery('#footer-core.option4 .widget-area').addClass("one_fourth"); 19 jQuery('#footer-core.option5 .widget-area').addClass("one_fifth"); 20 jQuery('#footer-core.option6 .widget-area').addClass("one_sixth"); 21 22 /* Footer - Footer Widgets Layout (Option 7) */ 23 jQuery('#footer-core.option7 #footer-col1.widget-area').addClass("one_third"); 24 jQuery('#footer-core.option7 #footer-col2.widget-area').addClass("two_third"); 25 26 /* Footer - Footer Widgets Layout (Option 8) */ 27 jQuery('#footer-core.option8 #footer-col1.widget-area').addClass("two_third"); 28 jQuery('#footer-core.option8 #footer-col2.widget-area').addClass("one_third"); 29 30 /* Footer - Footer Widgets Layout (Option 9) */ 31 jQuery('#footer-core.option9 #footer-col1.widget-area').addClass("one_fourth"); 32 jQuery('#footer-core.option9 #footer-col2.widget-area').addClass("three_fourth"); 33 34 /* Footer - Footer Widgets Layout (Option 10) */ 35 jQuery('#footer-core.option10 #footer-col1.widget-area').addClass("three_fourth"); 36 jQuery('#footer-core.option10 #footer-col2.widget-area').addClass("one_fourth"); 37 38 /* Footer - Footer Widgets Layout (Option 11) */ 39 jQuery('#footer-core.option11 #footer-col1.widget-area').addClass("one_fifth"); 40 jQuery('#footer-core.option11 #footer-col2.widget-area').addClass("four_fifth"); 41 42 /* Footer - Footer Widgets Layout (Option 12) */ 43 jQuery('#footer-core.option12 #footer-col1.widget-area').addClass("four_fifth"); 44 jQuery('#footer-core.option12 #footer-col2.widget-area').addClass("one_fifth"); 45 46 /* Footer - Footer Widgets Layout (Option 13) */ 47 jQuery('#footer-core.option13 #footer-col1.widget-area').addClass("one_sixth"); 48 jQuery('#footer-core.option13 #footer-col2.widget-area').addClass("one_sixth"); 49 jQuery('#footer-core.option13 #footer-col3.widget-area').addClass("one_sixth"); 50 jQuery('#footer-core.option13 #footer-col4.widget-area').addClass("one_half"); 51 52 /* Footer - Footer Widgets Layout (Option 14) */ 53 jQuery('#footer-core.option14 #footer-col1.widget-area').addClass("one_half"); 54 jQuery('#footer-core.option14 #footer-col2.widget-area').addClass("one_sixth"); 55 jQuery('#footer-core.option14 #footer-col3.widget-area').addClass("one_sixth"); 56 jQuery('#footer-core.option14 #footer-col4.widget-area').addClass("one_sixth"); 57 58 /* Footer - Footer Widgets Layout (Option 15) */ 59 jQuery('#footer-core.option15 #footer-col1.widget-area').addClass("one_sixth"); 60 jQuery('#footer-core.option15 #footer-col2.widget-area').addClass("one_third"); 61 jQuery('#footer-core.option15 #footer-col3.widget-area').addClass("one_half"); 62 63 /* Footer - Footer Widgets Layout (Option 16) */ 64 jQuery('#footer-core.option16 #footer-col1.widget-area').addClass("one_half"); 65 jQuery('#footer-core.option16 #footer-col2.widget-area').addClass("one_third"); 66 jQuery('#footer-core.option16 #footer-col3.widget-area').addClass("one_sixth"); 67 68 /* Footer - Footer Widgets Layout (Option 17) */ 69 jQuery('#footer-core.option17 #footer-col1.widget-area').addClass("one_fourth"); 70 jQuery('#footer-core.option17 #footer-col2.widget-area').addClass("one_fourth"); 71 jQuery('#footer-core.option17 #footer-col3.widget-area').addClass("one_sixth"); 72 jQuery('#footer-core.option17 #footer-col4.widget-area').addClass("one_sixth"); 73 jQuery('#footer-core.option17 #footer-col5.widget-area').addClass("one_sixth"); 74 75 /* Footer - Footer Widgets Layout (Option 18) */ 76 jQuery('#footer-core.option18 #footer-col1.widget-area').addClass("one_sixth"); 77 jQuery('#footer-core.option18 #footer-col2.widget-area').addClass("one_sixth"); 78 jQuery('#footer-core.option18 #footer-col3.widget-area').addClass("one_sixth"); 79 jQuery('#footer-core.option18 #footer-col4.widget-area').addClass("one_fourth"); 80 jQuery('#footer-core.option18 #footer-col5.widget-area').addClass("one_fourth"); 81}); 82 83 84/* ---------------------------------------------------------------------------------- 85 FORMAT SUB-FOOTER LAYOUT 86---------------------------------------------------------------------------------- */ 87jQuery(document).ready(function(){ 88 89 jQuery('#sub-footer-widgets .widget-area:last-child').addClass("last"); 90 jQuery('#sub-footer-widgets .widget-area:last-child').after( '<div class="clearboth"></div>' ); 91 92 /* Footer - Footer Widgets Layout (Option 2) */ 93 jQuery('#sub-footer-widgets.option2 .widget-area').addClass("one_half"); 94 95 /* Footer - Footer Widgets Layout (Option 3) */ 96 jQuery('#sub-footer-widgets.option3 #sub-footer-col1.widget-area').addClass("one_third"); 97 jQuery('#sub-footer-widgets.option3 #sub-footer-col2.widget-area').addClass("two_third"); 98 99 /* Footer - Footer Widgets Layout (Option 4) */ 100 jQuery('#sub-footer-widgets.option4 #sub-footer-col1.widget-area').addClass("two_third"); 101 jQuery('#sub-footer-widgets.option4 #sub-footer-col2.widget-area').addClass("one_third"); 102 103 /* Footer - Footer Widgets Layout (Option 5) */ 104 jQuery('#sub-footer-widgets.option5 #sub-footer-col1.widget-area').addClass("one_fourth"); 105 jQuery('#sub-footer-widgets.option5 #sub-footer-col2.widget-area').addClass("three_fourth"); 106 107 /* Footer - Footer Widgets Layout (Option 6) */ 108 jQuery('#sub-footer-widgets.option6 #sub-footer-col1.widget-area').addClass("three_fourth"); 109 jQuery('#sub-footer-widgets.option6 #sub-footer-col2.widget-area').addClass("one_fourth"); 110 111 /* Footer - Footer Widgets Layout (Option 7) */ 112 jQuery('#sub-footer-widgets.option7 #sub-footer-col1.widget-area').addClass("one_fifth"); 113 jQuery('#sub-footer-widgets.option7 #sub-footer-col2.widget-area').addClass("four_fifth"); 114 115 /* Footer - Footer Widgets Layout (Option 8) */ 116 jQuery('#sub-footer-widgets.option8 #sub-footer-col1.widget-area').addClass("four_fifth"); 117 jQuery('#sub-footer-widgets.option8 #sub-footer-col2.widget-area').addClass("one_fifth"); 118}); 119 120 121/* ---------------------------------------------------------------------------------- 122 MASONRY - LOAD AFTER IMAGES HAVE LOADED 123---------------------------------------------------------------------------------- */ 124 125jQuery(document).ready(function() { 126 127 // Call imagedLoaded for Masonry if imagedLoaded function is available 128 (function ( $ ) { 129 if ( $.isFunction($.fn.imagesLoaded) ) { 130 131 // Different target for masonry on portfolio pages than any other page 132 if ( $( '#container' ).hasClass( 'portfolio-wrapper' ) ) { 133 var $container = $('#container-inner'); 134 } else if ( $( 'body' ).hasClass( 'woo-shop-grid' ) ) { 135 var $container = $('#main-core .products'); 136 } else { 137 var $container = $('#container'); 138 } 139 140 $container.imagesLoaded( function() { 141 if ( $.isFunction($.fn.masonry) ) { 142 $container.masonry(); 143 } 144 }); 145 } 146 }( jQuery ));
147}); 148 149 150/* ---------------------------------------------------------------------------------- 151 FORMAT MAIN HEADER MENU 152---------------------------------------------------------------------------------- */ 153function mainmenu(){ 154 155 /* Add menu-hover class */ 156 jQuery("header .header-links ul.menu > li").hover(function(){ 157 jQuery(this).find('ul.sub-menu:first').css({visibility: "visible",display: "none"}).parent().addClass('menu-hover'); 158 },function(){ 159 jQuery(this).find('ul.sub-menu:first').css({visibility: "hidden",display: "none"}).parent().removeClass('menu-hover'); 160 }); 161 162 /* Add menu-parent class */ 163 jQuery("header .header-links ul.menu > li").each(function(){ 164 jQuery(this).find('ul.sub-menu').css({visibility: "visible",display: "none"}).parent().addClass('menu-parent'); 165 }); 166 167 // Change z-index of #pre-header so dropdown menus & tooltips can be seen 168 jQuery("#pre-header").hover(function(){ 169 jQuery( this ).css({ 'z-index' : '999991' }); 170 },function(){ 171 jQuery( this ).css({ 'z-index' : '999' }); 172 }); 173 174 /* Add smooth dropdown effect */ 175 jQuery("header .header-links li").hover(function(){ 176 parentWidth = jQuery(this).width(); 177 jQuery(this).find('ul:first').css({visibility: "visible",display: "none","min-width": parentWidth}).slideToggle(400); 178 },function(){ 179 jQuery(this).find('ul:first').css({visibility: "hidden"}); 180 }); 181 182 // Correct menu for below header when navigating down page. 183 if( jQuery( 'body' ).hasClass( 'header-below' ) ) { 184 jQuery('#header').waypoint(function(direction) { 185 if (direction === 'down') { 186 jQuery( 'body' ).addClass( 'header-below2' ); 187 } 188 else { 189 jQuery( 'body' ).removeClass( 'header-below2' ); 190 } 191 }, { 192 offset: '50%' 193 }); 194 } 195} 196jQuery(document).ready(function(){ 197 mainmenu(); 198}); 199 200 201/* ---------------------------------------------------------------------------------- 202 STICKY HEADER - ONLY ON SCREENS SMALLER THAN 768px 203---------------------------------------------------------------------------------- */ 204jQuery(window).load(function(){ 205 206 // Trigger sticky header on devices wider than 768px 207 if ( jQuery(window).width() > 768 && jQuery( 'body' ).hasClass( 'header-sticky' ) ) { 208 209 // Assign variables & data attributed for header links 210 var preheader_height = parseInt( jQuery( '#pre-header' ).css( 'height' ) ); 211 var header_height = parseInt( jQuery( '#header' ).css( 'height' ) ); 212 var header_pad_top = parseInt( jQuery( '#header .header-links > ul > li > a' ).css( 'padding-top' ) ); 213 var header_pad_bot = parseInt( jQuery( '#header .header-links > ul > li > a' ).css( 'padding-bottom' ) ); 214 215 jQuery( '#header .header-links > ul > li > a' ).attr( { 'data-padtop': header_pad_top } ); 216 jQuery( '#header .header-links > ul > li > a' ).attr( { 'data-padbot': header_pad_bot } ); 217 218 // Assign variables & data attributed for header logo 219 var logo_mar_top = parseInt( jQuery( '#header #logo' ).css( 'margin-top' ) ); 220 var logo_max_size = parseInt( jQuery( '#header #logo img' ).css( 'max-height' ) ); 221 222 jQuery( '#header' ).attr( { 'data-height': header_height } ); 223 jQuery( '#header #logo' ).attr( { 'data-martop': logo_mar_top } ); 224 jQuery( '#header #logo img' ).attr( { 'data-maxsize': logo_max_size } ); 225 226 // Add #header-sticky-space to control spacing when sticky header is activated 227 if( ( jQuery( 'body' ).hasClass( 'header-style1' ) && ! jQuery( 'body' ).hasClass( 'header-below' ) ) ) { 228 jQuery( '#site-header' ).prepend( '<div id="header-sticky-space"></div>' ); 229 jQuery( '#header-sticky-space' ).css( { 'height': preheader_height + header_height } ); 230 jQuery( '#header-sticky-space' ).attr( { 'data-height': preheader_height + header_height } ); 231 } 232 233 // Move #header below from #pre-header 234 if( ( jQuery( 'body' ).hasClass( 'header-style1' ) && ! jQuery( 'body' ).hasClass( 'header-below' ) ) || jQuery( 'body' ).hasClass( 'header-style2' ) && jQuery( 'body' ).hasClass( 'home' ) ) { 235 jQuery( '#header' ).attr( { 'data-top': preheader_height } ); 236 jQuery( '#header' ).css( 'margin-top', preheader_height ); 237 } 238 239 // Resize on scroll 240 jQuery(window).scroll(function() { 241
242 // Change padding on header link & logo when resized 243 if( ( jQuery( 'body' ).hasClass( 'header-style1' ) && ! jQuery( 'body' ).hasClass( 'header-below' ) ) || jQuery( 'body' ).hasClass( 'header-style2' ) ) { 244 245 // Assign variable values for sticky header 246 var header_padtop_end = 15; 247 var header_padbot_end = 15; 248 var logo_martop_end = 10; 249 var logo_maxsize_end = 35; 250 251 // Assign header height and position variables - used to mathematically change padding 252 var preheader_offset = jQuery( '#pre-header' ).offset(); 253 var preheader_height = jQuery( '#pre-header' ).height(); 254 255 var header_offset = jQuery( '#header' ).offset(); 256 var header_height = jQuery( '#header' ).height(); 257 var preheader_top = jQuery( '#header' ).attr( 'data-top' ); 258 259 // Move #header to cover #pre-header when scrolling down 260 if ( header_offset.top < preheader_height ) { 261 var preheader_offset_top = header_offset.top / preheader_height; 262 263 // Resize padding on header links 264 if( ( preheader_top * ( 1 - preheader_offset_top ) ) >= preheader_top ) { 265 if ( jQuery( 'body' ).hasClass( 'header-style1' ) || jQuery( 'body' ).hasClass( 'header-style2' ) && jQuery( 'body' ).hasClass( 'home' ) ) { 266 jQuery( '#header' ).css( { 'margin-top': preheader_top * ( 1 - preheader_offset_top ) } ); 267 } 268 jQuery( '#header-sticky-space' ).css( { 'margin-top': preheader_top * ( preheader_offset_top ) * -1 } ); 269 } 270 271 // Add header-stickyactive class to body tag - Header Style 1 (above slider) & 2 272 jQuery( 'body' ).removeClass( 'header-stickyactive' ); 273 274 } else { 275 if ( jQuery( 'body' ).hasClass( 'header-style1' ) || jQuery( 'body' ).hasClass( 'header-style2' ) && jQuery( 'body' ).hasClass( 'home' ) ) { 276 jQuery( '#header' ).css( { 'margin-top': 0 } ); 277 } 278 jQuery( '#header-sticky-space' ).css( { 'margin-top': preheader_top * -1 } ); 279 280 // Remove header-stickyactive class to body tag - Header Style 1 (above slider) & 2 281 jQuery( 'body' ).addClass( 'header-stickyactive' ); 282 } 283 284 // Resize #header elements 285 if ( header_offset.top <= header_height ) { 286 var header_offset_top = header_offset.top / header_height; 287 288 var header_space = jQuery( '#header-sticky-space' ).attr( 'data-height' ); 289 var header_pad_top = jQuery( '#header .header-links > ul > li > a' ).attr( 'data-padtop' ); 290 var header_pad_bot = jQuery( '#header .header-links > ul > li > a' ).attr( 'data-padbot' ); 291 292 var logo_mar_top = jQuery( '#header #logo' ).attr( 'data-martop' ); 293 var logo_max_size = jQuery( '#header #logo img' ).attr( 'data-maxsize' ); 294 295 // Resize padding on header links 296 if( ( header_pad_top * ( 1 - header_offset_top ) ) > header_padtop_end ) { 297 jQuery( '#header .header-links > ul > li > a' ).css( { 'padding-top': header_pad_top * ( 1 - header_offset_top ) } ); 298 jQuery( '#header .header-links > ul > li > a' ).css( { 'padding-bottom': header_pad_bot * ( 1 - header_offset_top ) } ); 299 300 if( ( jQuery( 'body' ).hasClass( 'header-style1' ) ) ) { 301 jQuery( '#header-sticky-space' ).css( { 'height': header_space * ( 1 - header_offset_top ) } ); 302 } 303 } 304 305 // Resize margin on logo top 306 if( ( logo_mar_top * ( 1 - header_offset_top ) ) > logo_martop_end ) { 307 jQuery( '#header #logo' ).css( { 'margin-top': logo_mar_top * ( 1 - header_offset_top ) } ); 308 } 309 310 // Resize logo image 311 if( ( logo_max_size * ( 1 - header_offset_top ) ) >= logo_maxsize_end ) { 312 jQuery( '#header #logo img' ).css( { 'max-height': logo_max_size * ( 1 - header_offset_top ) } ); 313 } 314 315 } else if ( header_offset.top > header_height ) { 316 var header_offset_top = header_offset.top / header_height; 317 jQuery( '#header .header-links > ul > li > a' ).css( { 'padding-top': header_padtop_end } ); 318 jQuery( '#header .header-links > ul > li > a' ).css( { 'padding-bottom': header_padbot_end } ); 319 320 jQuery( '#header #logo' ).css( { 'margin-top': logo_martop_end } ); 321 jQuery( '#header #logo img' ).css( { 'max-height': logo_maxsize_end } ); 322 323 if( ( jQuery( 'body' ).hasClass( 'header-style1' ) ) ) { 324 jQuery( '#header-sticky-space' ).css( { 'height': 0 } );; 325 } 326 } 327 } 328 329 // Assign header-stickyactive class to body tag - Header Style 1 (below slider) 330 if( jQuery( '#pre-header' ).height() == 0 || jQuery( 'body' ).hasClass( 'header-below' ) ) { 331 332 // Correct menu for below header when navigating down page. 333 jQuery('#header').waypoint(function(direction) { 334 335 var header_offset = jQuery( '#header' ).offset(); 336 var header_height = jQuery( '#header' ).height(); 337 338 var preheader_height = jQuery( '#header' ).attr( 'data-top' ); 339 340 if (direction === 'down') { 341 if( jQuery( 'body' ).hasClass( 'header-below' ) ) { 342 jQuery( 'body' ).addClass( 'header-stickyactive' ); 343 } else { 344 if ( header_offset.top > header_height ) { 345 jQuery( 'body' ).addClass( 'header-stickyactive' ); 346 } 347 } 348 } else { 349 if( jQuery( 'body' ).hasClass( 'header-below' ) ) { 350 jQuery( 'body' ).removeClass( 'header-stickyactive' ); 351 } else { 352 if ( header_offset.top <= header_height ) { 353 jQuery( 'body' ).removeClass( 'header-stickyactive' ); 354 } 355 } 356 } 357 }); 358 } 359 }); 360 } 361}); 362 363 364/* ---------------------------------------------------------------------------------- 365 FLUID MEDIA SIZES (Modified from http://bavotasan.com/2012/better-way-to-resize-video-using-jquery) 366---------------------------------------------------------------------------------- */ 367 368/* Videos */ 369jQuery(document).ready(function() { 370
371 /* Supported Platforms */ 372 var all_videos = jQuery( 'iframe[src*="//player.vimeo.com"], iframe[src*="//www.youtube.com"], iframe[src*="//blip.tv"], iframe[src*="//www.slideshare.net"], iframe[src*="//www.scribd.com"], iframe[src*="//revision3.com"], iframe[src*="//www.hulu.com"], iframe[src*="//www.funnyordie.com"], iframe[src*="//www.dailymotion.com"], iframe[src*="//maps.google.com"], embed[src*="//v.wordpress.com"], object, embed' ); 373 374 all_videos.each(function() { 375 var el = jQuery(this); 376 el 377 .attr( 'data-aspectRatio', 360 / 640 ) 378 .attr( 'data-oldWidth', el.width() ); 379 } ); 380 381 jQuery(document).ready(function() { 382 all_videos.each( function() { 383 var el = jQuery(this), 384 newWidth = el.parents().width(), 385 oldWidth = el.attr( 'data-oldWidth' ); 386 ratioHeight = el.height() / el.outerHeight(), 387 388 el 389 .removeAttr( 'height' ) 390 .removeAttr( 'width' ) 391 .width( newWidth * ratioHeight ) 392 .outerHeight( newWidth * el.attr( 'data-aspectRatio' ) ); 393 }); 394 }).resize(); 395 396 jQuery(window) 397 .resize( function() { 398 all_videos.each( function() { 399 var el = jQuery(this), 400 newWidth = el.parents().width(), 401 oldWidth = el.attr( 'data-oldWidth' ); 402 ratioHeight = el.height() / el.outerHeight(), 403 404 el 405 .removeAttr( 'height' ) 406 .removeAttr( 'width' ) 407 .width( newWidth * ratioHeight ) 408 .outerHeight( newWidth * el.attr( 'data-aspectRatio' ) ); 409 }); 410 }).resize(); 411}); 412 413/* SoundCloud */ 414jQuery(document).ready(function() { 415 416 /* Supported Platforms */ 417 var all_sounds = jQuery( 'iframe[src^="http://w.soundcloud.com"]' ); 418 419 all_sounds.each(function() { 420 var el = jQuery(this); 421 el 422 .attr( 'data-aspectRatio', el.attr( 'height' ) / el.attr( 'width' ) ) 423 .attr( 'data-oldWidth', el.width() ); 424 }); 425 426 jQuery(document).ready(function() { 427 all_sounds.each( function() { 428 var el = jQuery(this), 429 newWidth = el.parents().width(), 430 oldWidth = el.attr( 'data-oldWidth' ); 431 432 el 433 .removeAttr( 'width' ) 434 .width( newWidth ) 435 }); 436 }).resize(); 437 438 jQuery(window) 439 .resize( function() { 440 all_sounds.each( function() { 441 var el = jQuery(this), 442 newWidth = el.parents().width(), 443 oldWidth = el.attr( 'data-oldWidth' ); 444 445 el 446 .removeAttr( 'width' ) 447 .width( newWidth ) 448 }); 449 }).resize(); 450}); 451 452 453/* ---------------------------------------------------------------------------------- 454 ADD PRETTYPHOTO TO PORTFOLIO PAGE 455---------------------------------------------------------------------------------- */ 456 457jQuery(document).ready(function() { 458 jQuery('#container.portfolio-wrapper a').has('img.hover-zoom').addClass('prettyPhoto'); 459 jQuery('#container.portfolio-wrapper a').has('img.hover-zoom').attr('rel','portfolio[gallery]'); 460 jQuery('a.prettyPhoto').has('img').attr('rel','portfolio[gallery]'); 461 jQuery('a.prettyPhoto').prettyPhoto(); 462}); 463 464 465/* ---------------------------------------------------------------------------------- 466 ADD PRETTYPHOTO TO POST IMAGE PAGE 467---------------------------------------------------------------------------------- */ 468 469jQuery(document).ready(function() { 470 jQuery('body.attachment .entry-attachment .attachment a').has('img').addClass('prettyPhoto'); 471 jQuery('a.prettyPhoto').prettyPhoto(); 472}); 473 474 475/* ---------------------------------------------------------------------------------- 476 ADD _BLANK TO OUTGOING LINKS 477---------------------------------------------------------------------------------- */ 478 479jQuery(document).ready(function(){ 480 jQuery('.thinkup_widget_flickr a[href^="http://"], .thinkup_widget_flickr a[href^="https://"]').attr('target','_blank'); 481 jQuery('.thinkup_widget_socialshare a[href^="http://"], .thinkup_widget_socialshare a[href^="https://"]').attr('target','_blank'); 482 jQuery('.thinkup_widget_socialprofiles a[href^="http://"], .thinkup_widget_socialprofiles a[href^="https://"]').attr('target','_blank'); 483 jQuery('#pre-header-social a[href^="http://"], #pre-header-social a[href^="https://"]').attr('target','_blank'); 484 jQuery('#shareicons a[href^="http://"], #shareicons a[href^="https://"]').attr('target','_blank'); 485}); 486 487 488/* ---------------------------------------------------------------------------------- 489 SHORTCODES 490---------------------------------------------------------------------------------- */ 491 492jQuery(window).load(function() { 493 494 /* Accordion - Fix Bootstrap Toggle Issue */ 495 jQuery('.accordion-toggle').click(function() { 496 if(jQuery(this).hasClass('collapsed')) { 497 jQuery(this).closest('.accordion').find('.accordion-toggle').not(this).addClass('collapsed'); 498 } 499 }); 500 501 /* Divider - Scroll To Top */ 502 jQuery('.backtotop').click(function(){ 503 jQuery('html, body').animate({scrollTop:0}, 'slow'); 504 }); 505 506 /* Tooltip - Activate Bootstrap */ 507 jQuery('[data-tip]').each( function() {jQuery(this).tooltip({ placement: jQuery(this).data('tip') }); }); 508 509 /* Blog Post - Carousel (used for identifying if input variable is an integer */ 510 function isNumber(n) { 511 return !isNaN(parseFloat(n)) && isFinite(n); 512 } 513 514 /* Blog Post - Activate CarouFredSel */ 515 jQuery(window).bind( 'load resize', function() { 516 jQuery( '.sc-carousel' ).each( function(i) { 517 518 // Don't run caroufredsel code if the following classes are present. 519 if ( jQuery( this ).hasClass( 'sc-postitem' ) || 520 jQuery( this ).hasClass( 'sc-featured' ) || 521 jQuery( this ).hasClass( 'sc-image' ) ) { 522 return; 523 }; 524
525 var instanceID = 'sc-carousel-' + i; 526 527 jQuery( this ).attr( 'id', instanceID ); 528 529 jQuery( this ).children( 'ul').attr( 'id', instanceID + '-inner' ); 530 531 var show = jQuery( '#' + instanceID + '.sc-carousel' ).data( 'show' ); 532 var scroll = jQuery( '#' + instanceID + '.sc-carousel' ).data( 'scroll' ); 533 var speed = jQuery( '#' + instanceID + '.sc-carousel' ).data( 'speed' ); 534 var effect = jQuery( '#' + instanceID + '.sc-carousel' ).data( 'effect' ); 535 536 if ( show == 0 || isNaN( show ) == true ) show = '3'; 537 if ( scroll == 0 || isNaN( scroll ) == true ) scroll = '1'; 538 if ( speed == 0 ) speed = '500'; 539 if ( effect == 0 ) { 540 effect = '"scroll"'; 541 } else { 542 effect = '"' + effect + '"'; 543 } 544 545 var showItems = show; 546 var scrollItems = scroll; 547 var speedItems = speed; 548 var fxItems = effect; 549 550 var width = jQuery(window).width(); 551 552 if ( jQuery( 'body' ).hasClass( 'layout-responsive' ) ) { 553 if(width <=685) { 554 showItems = 2; 555 if( scrollItems >= 2 ) { 556 scrollItems = 2; 557 } 558 } 559 if(width <=480) { 560 showItems = 1; 561 scrollItems = 1; 562 } 563 } 564 565 // Apply carousel code if needed 566 if ( jQuery( this ).find( '#' + instanceID + '-inner' ).length ) { 567 568 jQuery( this ).find( '#' + instanceID + '-inner' ).carouFredSel({ 569 width: '100%', 570 items : { 571 visible : showItems, 572 minimum : 3, 573 minimum : 3, 574 start: 0 575 }, 576 scroll : { 577 items : scrollItems, 578 fx : fxItems, 579 easing : "swing", 580 duration : speedItems, 581 }, 582 responsive : true, 583 circular : true, 584 infinite : false, 585 auto : false, 586 prev : { 587 button : '#' + instanceID + ' .prev', 588 key : 'left' 589 }, 590 next : { 591 button : '#' + instanceID + ' .next', 592 key : 'right' 593 }, 594 pagination : '#' + instanceID + ' .pagination', 595 onCreate: function () { 596 jQuery(window).bind("load resize", function() { 597 598 // Set height to testimonial carousel elements - All 599 parentWidthTestimonial = jQuery( '#' + instanceID + '.carousel-testimonial li').outerHeight(); 600 jQuery( '#' + instanceID + '.carousel-testimonial' ).height( 'auto' ); 601 jQuery( '#' + instanceID + '.carousel-testimonial .caroufredsel_wrapper' ).css( { 'height': parentWidthTestimonial } ); 602 603 // Set height to testimonial carousel elements - Fix Style 1 604 parentWidthTestimonial_1 = jQuery( '#' + instanceID + '.carousel-testimonial.style1 .caroufredsel_wrapper').outerHeight(); 605 parentWidthTestimonial_2 = jQuery( '#' + instanceID + '.carousel-testimonial.style1 .sc-carousel-thumbs').outerHeight(); 606 607 jQuery( '#' + instanceID + '.carousel-testimonial.style1' ).height( parentWidthTestimonial_1 + parentWidthTestimonial_2 ); 608 jQuery( '#' + instanceID + '.carousel-testimonial.style1 .sc-carousel-thumbs' ).parent().height( parentWidthTestimonial_2 ); 609 }); 610 } 611 }); 612 } 613 614 // Used for adding thumbnails to slider - Currently only for Testimonials slider 615 if ( jQuery( this ).find('.sc-carousel-thumbs').length ) { 616 617 jQuery( this ).find('.sc-carousel-thumbs').carouFredSel({ 618 responsive: true, 619 circular: false, 620 infinite: false, 621 auto: false, 622 prev: '#prev', 623 next: '#next', 624 items: { 625 visible: { 626 min: 2, 627 max: 6 628 }, 629 width: 150, 630 height: 70 631 } 632 }); 633 } 634 635 jQuery( this ).find('.sc-carousel-thumbs a').click(function() { 636 jQuery('#' + instanceID + '-inner').trigger('slideTo', '#' + this.href.split('#').pop() ); 637 jQuery('.sc-carousel-thumbs a').removeClass('selected'); 638 jQuery( this ).addClass('selected'); 639 return false; 640 }); 641 642 // Set carousel container height 643 parentHeight = jQuery( '#' + instanceID + ' li').height(); 644 jQuery( '#' + instanceID + ' li' ).each(function() { 645 var elementHeight = jQuery(this).height(); 646 parentHeight = elementHeight > parentHeight ? elementHeight : parentHeight; 647 }); 648 649 // Add addition height if carousel thumbnails are showing 650 if( jQuery( '#' + instanceID ).closest('.sc-carousel').find('.sc-carousel-thumbs').length > 0 ) { 651 parentHeightThumb = parentHeight + jQuery( '#' + instanceID ).closest('.sc-carousel').find('.sc-carousel-thumbs').height(); 652 } else { 653 parentHeightThumb = parentHeight; 654 } 655 656 // Assign height to unique carousel ID (Max used to ensure thumbnail carousel displays correctly) 657 jQuery( '#' + instanceID ).height( Math.max( parentHeight, parentHeightThumb ) ); 658 jQuery( '#' + instanceID + '-inner' ).height( parentHeight ); 659 jQuery( '#' + instanceID + '-inner' ).parent().height( parentHeight ); 660 661 // Set carousel container height to auto if iframe exists in featured images 662 if ( jQuery( '#' + instanceID + ' iframe').length > 0 ) { 663 jQuery( '#' + instanceID ).addClass('carousel-iframe'); 664 } 665 }); 666 667 }).resize(); 668 669 /* Progress Bar - Animate Width */ 670 jQuery('.progress').waypoint( 671 function(event, direction) { 672 673 var width = jQuery(this).children().attr('data-width');
674 var delay = jQuery(this).children().attr('data-delay'); 675 676 jQuery(this).delay( delay ).queue(function(next){ 677 jQuery(this).children().css( 'width', width + '%' ); 678 }); 679 }, { 680 offset: 'bottom-in-view' 681 }); 682 683 /* Progress Knob - Triggers and adds a delay is set by user */ 684 jQuery(document).ready(function() { 685 686 // Trigger knob so that input box doesn't show (with percentage) - Progress (Round) 687 jQuery( '.sc-knob:not(.sc-counter) .sc-knob-dial' ).knob({ 688 'draw' : function () { 689 jQuery(this.i).val(this.cv + '%'); 690 } 691 }) 692 693 // Trigger knob so that input box doesn't show (without percentage) - Counter 694 jQuery( '.sc-knob.sc-counter .sc-knob-dial' ).knob({ 695 'draw' : function () { 696 697 // Add suffix set 698 var suffix = jQuery(this.i).attr( 'data-suffix' ); 699 700 // Remove value is set to zero 701 if( this.cv == '0') { 702 this.cv = '' 703 }; 704 705 jQuery(this.i).val(this.cv + suffix); 706 } 707 }) 708 709 // Trigger waypoint for all knobs 710 jQuery( '.sc-knob' ).waypoint( 711 function(event, direction) { 712 jQuery('.sc-knob .sc-knob-dial').each( function(i) { 713 714 var instanceID = 'sc-knob-' + i; 715 716 jQuery( this ).attr( 'id', instanceID ); 717 718 var input_time = jQuery( '#sc-knob-' + i ).attr('data-delay'); 719 var input_value = jQuery( '#sc-knob-' + i ).attr('data-value'); 720 721 setTimeout(function() { 722 jQuery({ 723 value: 0 724 }).animate({ 725 value: input_value 726 }, { 727 duration: 2000, 728 easing: 'swing', 729 step: function() { 730 return jQuery('#sc-knob-' + i).val(Math.ceil(this.value)).trigger('change'); 731 } 732 }); 733 }, input_time ); 734 }); 735 }, { 736 offset: 'bottom-in-view', 737 triggerOnce: true 738 }); 739 }); 740 741 /* Make ThinkUpSlider shortcode full width if specified */ 742 jQuery( '.thinkupslider-sc' ).each(function( index, element ){ 743 744 jQuery( element ).attr( 'id', 'thinkupbuilder-thinkupsliderimage-' + index ); 745 746 // Collect slider parameter values 747 var wide = jQuery( element ).data( 'wide' ); 748 749 // Format row section for full-screen slider 750 if ( wide == 'on' ) { 751 jQuery( element ).closest( '.panel-grid' ).css( 'padding', 0 ); 752 jQuery( element ).closest( '.panel-grid-core' ).css( 'margin', 0 ).css( 'maxWidth', '100%' ); 753 jQuery( element ).closest( '.panel-grid-cell' ).css( 'padding', 0 ); 754 } 755 }); 756 757 /* Make slider full width if specified */ 758 jQuery( '.rslides-sc' ).each(function( index, element ){ 759 760 jQuery( element ).attr( 'id', 'thinkupbuilder-sliderimage-' + index ); 761 762 // Collect slider parameter values 763 var wide = jQuery( element ).data( 'wide' ); 764 765 // Format row section for full-screen slider 766 if ( wide == 'on' ) { 767 jQuery( element ).closest( '.panel-grid' ).css( 'padding', 0 ); 768 jQuery( element ).closest( '.panel-grid-core' ).css( 'margin', 0 ).css( 'maxWidth', '100%' ); 769 jQuery( element ).closest( '.panel-grid-cell' ).css( 'padding', 0 ); 770 } 771 }); 772}); 773 774 775/* ---------------------------------------------------------------------------------- 776 SHORTCODES - WAYPOINTS ANIMATION 777---------------------------------------------------------------------------------- */ 778 779jQuery(document).ready(function() { 780 781 jQuery('.anim-start-ltr').waypoint( 782 function(event, direction) { 783 var time = jQuery(this).parent().attr('title'); 784 785 jQuery(this).delay( time ).queue(function(next){ 786 jQuery(this).removeClass( 'anim-start-ltr' ).addClass( 'anim-end-ltr' ); 787 jQuery(this).parent().removeAttr( 'title' ); 788 }); 789 }, { 790 offset: 'bottom-in-view' 791 }); 792 793 jQuery('.anim-start-rtl').waypoint( 794 function(event, direction) { 795 var time = jQuery(this).parent().attr('title'); 796 797 jQuery(this).delay( time ).queue(function(next){ 798 jQuery(this).removeClass( 'anim-start-rtl' ).addClass( 'anim-end-rtl' ); 799 jQuery(this).parent().removeAttr( 'title' ); 800 }); 801 }, { 802 offset: 'bottom-in-view' 803 }); 804 805 jQuery('.anim-start-btt').waypoint( 806 function(event, direction) { 807 var time = jQuery(this).parent().attr('title'); 808 809 jQuery(this).delay( time ).queue(function(next){ 810 jQuery(this).removeClass( 'anim-start-btt' ).addClass( 'anim-end-btt' ); 811 jQuery(this).parent().removeAttr( 'title' ); 812 }); 813 }, { 814 offset: 'bottom-in-view' 815 }); 816 817 jQuery('.anim-start-ttb').waypoint( 818 function(event, direction) { 819 var time = jQuery(this).parent().attr('title'); 820 821 jQuery(this).delay( time ).queue(function(next){ 822 jQuery(this).removeClass( 'anim-start-ttb' ).addClass( 'anim-end-ttb' ); 823 jQuery(this).parent().removeAttr( 'title' ); 824 }); 825 }, { 826 offset: 'bottom-in-view' 827 }); 828 829 jQuery('.anim-start-stb').waypoint( 830 function(event, direction) { 831 var time = jQuery(this).parent().attr('title'); 832 833 jQuery(this).delay( time ).queue(function(next){ 834 jQuery(this).removeClass( 'anim-start-stb' ).addClass( 'anim-end-stb '+ time ); 835 jQuery(this).parent().removeAttr( 'title' ); 836 }); 837 }, { 838 offset: 'bottom-in-view' 839 }); 840 841}); 842 843 844/* ---------------------------------------------------------------------------------- 845 HEADER SEARCH 846---------------------------------------------------------------------------------- */ 847 848jQuery(document).ready(function() { 849 jQuery('#header-search a').click(function() { 850 if ( ! jQuery( '#header-search' ).hasClass( 'active' ) ) { 851 jQuery( '#header-search' ).addClass( 'active' ); 852 } else { 853 jQuery( '#header-search' ).removeClass( 'active' ); 854 } 855 }); 856}); 857 858 859/* ---------------------------------------------------------------------------------- 860 SCROLL TO TOP BUTTON 861---------------------------------------------------------------------------------- */ 862 863jQuery(document).ready(function() { 864 if ( jQuery( 'body' ).hasClass( 'scrollup-on' ) ) { 865 (function($) { 866 $(function () { 867 $.scrollUp({ 868 scrollName: 'scrollUp', // Element ID 869 scrollText: '', // Text for element, can contain HTML 870 }); 871 }); 872 } (jQuery) ); 873 } 874}); 875 876 877/* ---------------------------------------------------------------------------------- 878 SUB-FOOTER WIDGETS - CLOSE BUTTON 879---------------------------------------------------------------------------------- */ 880 881// Sub-Footer Widget - Close Button 882jQuery('#sub-footer-close-core').click(function() { 883 if(jQuery( this ).hasClass('collapsed')) { 884 jQuery( this ).removeClass('collapsed'); 885 jQuery( '#sub-footer-widgets' ).removeClass('collapsed'); 886 } else { 887 jQuery( this ).addClass('collapsed'); 888 jQuery( '#sub-footer-widgets' ).addClass('collapsed'); 889 } 890}); 891 892 893/* ---------------------------------------------------------------------------------- 894 SLIDER ICON - SMOOTH SCROLL 895---------------------------------------------------------------------------------- */ 896 897jQuery(document).ready(function (){ 898 899 // Add #thinkupslider-after 900 if ( jQuery( '.featured-icon' ) ) { 901 jQuery( '#slider' ).after( '<div id="thinkupslider-after"></div>' ); 902 } 903 904 // Scroll To #thinkupslider-after 905 jQuery('.featured-icon a').click(function(e){
906 e.preventDefault(); 907 jQuery('html, body').animate( { scrollTop: jQuery( '#thinkupslider-after' ).offset().top }, 1000 ); 908 }); 909}); 910 911 912/* ---------------------------------------------------------------------------------- 913 WOOCOMMERCE - SOCIAL SHARING 914---------------------------------------------------------------------------------- */ 915 916jQuery(document).ready(function (){ 917 918 // Add active class to social sharing button 919 jQuery('.woo-share').click(function(e){ 920 921 if ( jQuery( this ).hasClass( 'active' ) ) { 922 jQuery( this ).removeClass( 'active' ); 923 jQuery( this ).closest( '.woo-meta' ).find( '.woo-meta-social' ).removeClass( 'active' ); 924 } else { 925 jQuery( this ).addClass( 'active' ); 926 jQuery( this ).closest( '.woo-meta' ).find( '.woo-meta-social' ).addClass( 'active' ); 927 } 928 }); 929}); 930
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.