1// JavaScript Document 2jQuery(document).ready(function(){ 3 'use strict'; 4 5 //Extend Modernizr 6 rockthemes_extend_modernizr(); 7 8 //Detect Browser CSS prefix 9 var spfx = '';//Style prefix 10 switch(BrowserDetect.browser){ 11 case 'Chrome': 12 spfx = '-webkit-'; 13 break; 14 15 case 'Explorer': 16 spfx = '-ms-'; 17 break; 18 19 case 'Firefox': 20 spfx = '-moz-'; 21 break; 22 23 case 'Safari': 24 spfx = '-webkit-'; 25 break; 26 27 case 'Opera': 28 spfx = '-o-'; 29 break; 30 } 31 if(spfx != ''){ 32 rockthemes.frontend_options.style_prefix = spfx; 33 } 34 35 //Check if mobile 36 if(Modernizr.ismobile){ 37 jQuery('html').addClass('disable-transition'); 38 } 39 40 41 //Activate Nice Scroll 42 if(rockthemes.frontend_options.activate_smooth_scroll === 'true' ){ 43 44 /* 45 ** Nice Scroll - the scroll bar from right side 46 */ 47 if(!(/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i).test(navigator.userAgent || navigator.vendor || window.opera) && !(navigator.userAgent.match(/msie|trident/i))){ 48 var rockthemes_nice_s_object = { 49 cursorcolor: typeof rockthemes.colors !== 'undefined' && rockthemes.colors ? rockthemes.colors.main_color : "#56CCC8", 50 cursorwidth: "14px", 51 cursorborder: "none", 52 cursorborderradius: "4px", 53 zindex: "999999", 54 bouncescroll: "true", 55 cursoropacitymin: "0.3", 56 background: "rgba(0,0,0,0.3)", 57 horizrailenabled : (rockthemes.resposivity === 'false') ? true : false 58 }; 59 60 61 //Set some values to make scroll smoother 62 rockthemes_nice_s_object.scrollspeed = 98; 63 rockthemes_nice_s_object.mousescrollstep = 48; 64 65 if(rockthemes.frontend_options.nicescroll_style_enabled !== 'yes'){ 66 //Disable Nicescroll scrollbar style 67 jQuery('html').addClass('nicescroll-style-disabled'); 68 rockthemes_nice_s_object.autohidemode = 'hidden'; 69 } 70 71 var rockthemes_nice_s = jQuery('html').niceScroll(rockthemes_nice_s_object); 72 rockthemes.elements = new Object(); 73 rockthemes.elements.nice_scroll = rockthemes_nice_s; 74 75 jQuery(document).on('rockthemes:nicescroll_enable', function(){ 76 rockthemes_nice_s.show(); 77 }); 78 jQuery(document).on('rockthemes:nicescroll_disable', function(){ 79 //Remove Nice Scroll HTML transform details (delay breaks the effect header fade effect) 80 jQuery('html').css('transform',''); 81 rockthemes_nice_s.stop(); 82 rockthemes_nice_s.hide(); 83 }); 84 85 } 86 } 87 88 89 //Enable scrolling events before starting any elements. 90 rockthemes_scroll_events(); 91 92 if(typeof rockthemes.settings == "undefined"){ 93 rockthemes.settings = new Object(); 94 } 95 //Undermenu box uses different classes for active cart and search. We store their active class names here 96 rockthemes.settings.undermenu_box_classes = ['woocommerce-cart-active', 'search-box-active']; 97 98 99 if(typeof rockthemes.init_queue == 'undefined'){ 100 //Some elements load async, this variable is global and will hold those elements in the queue 101 rockthemes.init_queue = new Object(); 102 103 //Full screen video elements in queue. Youtube loads async 104 rockthemes.init_queue.fullscreen_bg_videos = new Array(); 105 } 106 107 108 rockthemes_fullscreen_elements(); 109 jQuery(window).smartresize(rockthemes_fullscreen_elements); 110 111 112 //Set header motions height. Disable it if it's mobile 113 if(jQuery('.rockthemes-before-header.intro-effect-slide').children().length && (jQuery(window).width() >= 768 || jQuery(window).height() >= 768)){ 114 var eh = jQuery('.rockthemes-before-header.intro-effect-slide').height(); //Effect Height 115 if(eh < 667) eh = 667; 116 jQuery('.rockthemes-before-header.intro-effect-slide').css('height', eh+'px'); 117 }else{ 118 //If there are not header top elements, then remove the class 119 jQuery('.rockthemes-before-header.intro-effect-slide').removeClass('intro-effect-slide'); 120 } 121 122 rockthemes_multi_bg_colors(); 123 jQuery(window).smartresize(function(){ 124 setTimeout(rockthemes_multi_bg_colors,180); 125 }); 126 127 jQuery('.disable-link').click(function(e){ 128 e.preventDefault(); 129 }); 130 131 rocktheme_wrap_iframe_videos(); 132 133 rockthemes_main_menu(); 134 135 rockthemes_mobile_menu(); 136 137 rockthemes_menu_ajax_search(); 138 139 //WooCommerce Details 140 rockthemes_woocommerce_elements_init(); 141 rockthemes_menu_ajax_woocommerce_cart(); 142 143 //Check background videos for muting them. Youtube, Vimeo, HTML5 144 rockthemes_check_bg_videos(); 145 146 //Check if there are any flash. If so make them responsive. 147 rockthemes_responsive_flash(); 148 149 //Activate Hover Effects 150 rockthemes_activate_hover(); 151 152 //Activate if there are load more buttons 153 rockthemes_activate_load_more(); 154 155 //Activate category ajax filters
156 rockthemes_activate_cat_filter_ajax(); 157 158 //Activate element's javascripts 159 rockthemes_activate_elements_js(); 160 161 //Activate Appear for motions 162 rockthemes_activate_down_arrows(); 163 164 //Activate Animations of elements (Uses css/animate.css file) 165 //rockthemes_activate_animations(); 166 167 //Activate Loader 168 rockthemes_activate_loader_motion(); 169 170 //If font loading system is active, we will also set visibility to hidden for the "body". This will set it to visible 171 jQuery(document).on('rockthemes:all_fonts_loaded', function(){ 172 //Full loading system will use this. Currently disabled 173 jQuery('body').css('visibility','visible'); 174 175 var hmf_elements = ['.sticky-header-wrapper', '.main-header-area', '.header-top-2', '.azoom-title-breadcrumbs']; 176 //if(jQuery(hmf_elements[0]+'.not-visible').length){ 177 for(var i=0;i<hmf_elements.length;i++){ 178 if(jQuery(hmf_elements[i]+'.not-visible').length){ 179 jQuery(hmf_elements[i]+'.not-visible').removeClass('not-visible'); 180 } 181 } 182 //} 183 jQuery(document).trigger('rockthemes:mega_menu_resize'); 184 }); 185 186 if(rockthemes.fonts.activate_font_loading === 'true'){ 187 if(jQuery('html').hasClass('rockthemes_fonts_loaded')){ 188 jQuery(document).trigger('rockthemes:all_fonts_loaded'); 189 }else{ 190 /* 191 ** IE Font Loading fix 192 ** IE sometimes does not trigger the event for font loading. This fix will trigger it on a timer 193 */ 194 var font_max_try = 10, 195 font_current_try = 0, 196 font_int = setInterval(function(){ 197 if(jQuery('html').hasClass('rockthemes_fonts_loaded') || font_current_try >= font_max_try){ 198 jQuery(document).trigger('rockthemes:all_fonts_loaded'); 199 clearInterval(font_int); 200 } 201 font_current_try++; 202 },500); 203 } 204 }else{ 205 jQuery(document).trigger('rockthemes:all_fonts_loaded'); 206 } 207 208 209 210}); 211 212 213 214 215function rockthemes_main_menu(){ 216 217 var on_menu = false, 218 temp_om = false, 219 out_menu = false, 220 t_time = 180, 221 o_time = 300, 222 h_timer = false, 223 o_timer = false, 224 nav = jQuery('#nav'), 225 sel = '#nav > ul > li.menu-item-has-children, ul#nav > li.menu-item-has-children'; 226 227 228 var mega = { 229 hover : function(that){ 230 on_menu = that.attr('id'); 231 232 that.addClass('hovering'); 233 234 clearTimeout(h_timer); 235 h_timer = setTimeout(function(){ 236 237 //Return if we have moved mouse out of the menu 238 if(!on_menu) return; 239 240 //Return if this is the same menu item 241 if(on_menu != that.attr('id') || !that.hasClass('hovering')){ 242 return; 243 } 244 245 jQuery('#nav .hover, #nav .hovering').removeClass('hover hovering'); 246 247 that.addClass('hover'); 248 249 }, t_time); 250 }, 251 out: function(that){ 252 253 that.removeClass('hovering'); 254 255 on_menu = false; 256 out_menu = that.attr('id'); 257 258 clearTimeout(o_timer); 259 o_timer = setTimeout(function(){ 260 261 //Return if user hovered another menu item 262 if(on_menu || that.hasClass('hovering')) return; 263 jQuery('#nav .hover, #nav .hovering').removeClass('hover hovering'); 264 265 }, o_time); 266 } 267 } 268 269 jQuery(document).on('mouseenter', sel, function(e){ 270 var that = jQuery(this); 271 mega.hover(that); 272 }); 273 jQuery(document).on('mouseleave', sel, function(e){ 274 var that = jQuery(this); 275 mega.out(that); 276 }); 277 278 279 if(1 == 1){ 280 //TO DO : Bind to an option 281 if(typeof Modernizr != "undefined" && Modernizr.touch){ 282 jQuery(document).on('touchend', '#nav .menu-item-has-children > a', function(e){ 283 e.preventDefault(); 284 var that = jQuery(this).parent(); 285 if(that.hasClass('hover')){ 286 that.removeClass('hover'); 287 }else{ 288 that.siblings().removeClass('hover').end().addClass('hover'); 289 } 290 }); 291 } 292 } 293 294} 295 296 297 298 299function rockthemes_activate_loader_motion(){ 300 var loader_classes = ['.woocommerce-loader', '.load-more-button-loader', '.ajax-category-navigation-loader', '.azoom-search-loader']; 301 302 var use_gif = false; 303 if(jQuery('html').hasClass('ie9')){ 304 use_gif = true; 305 } 306 307 if(use_gif){ 308 if(jQuery('.rockthemes-css-loader').length){ 309 jQuery('.rockthemes-css-loader > div > div').remove(); 310 jQuery('.rockthemes-css-loader .gif-loader').removeClass('hidden'); 311 jQuery('.rockthemes-css-loader').removeClass('rockthemes-css-loader'); 312 } 313 314 if(jQuery('.azoom-search-loader').length){ 315 jQuery('.azoom-search-loader').after(rockthemes.gif_loader); 316 } 317 318 for(var i = 0; i<loader_classes.length; i++){ 319 if(jQuery(loader_classes[i]).length){ 320 jQuery(loader_classes[i]).remove(); 321 } 322 } 323 }else{ 324 if(jQuery('.rockthemes-css-loader .gif-loader').length){ 325 jQuery('.rockthemes-css-loader .gif-loader').remove(); 326 } 327 } 328} 329 330 331 332 333function rockthemes_scroll_events(){ 334 if(typeof rockthemes.events == 'undefined'){ 335 rockthemes.events = new Object(); 336 } 337 rockthemes.events.scroll_keys = [37, 38, 39, 40]; 338 var don_wheel = window.onwheel;// Default On Wheel 339 340 jQuery(document).on('rockthemes:scroll_events_enable', function(){ 341 window.onwheel = don_wheel; 342 if(rockthemes.frontend_options.activate_smooth_scroll === 'true'){ 343 //If nicescroll acivated trigger this event. 344 jQuery(document).trigger('rockthemes:nicescroll_enable'); 345 } 346 347 jQuery(document).off('wheel DOMMouseScroll onmousewheel', wheel); 348 jQuery(window).off('onmousewheel onwheel', wheel); 349 document.onkeydown = null; 350 }); 351 jQuery(document).on('rockthemes:scroll_events_disable', function(){ 352 if(rockthemes.frontend_options.activate_smooth_scroll === 'true'){ 353 //If nicescroll acivated trigger this event. 354 jQuery(document).trigger('rockthemes:nicescroll_disable'); 355 } 356 jQuery(document).on('wheel DOMMouseScroll onmousewheel', wheel); 357 jQuery(window).on('onmousewheel onwheel', wheel); 358 document.onkeydown = keydown; 359 }); 360 361 362 function rockthemes_preventDefault(e) { 363 e = e || window.event; 364 if (e.preventDefault) 365 e.preventDefault(); 366 if(e.stopImmediatePropagation) 367 e.stopImmediatePropagation(); 368 369 e.returnValue = false; 370 return false; 371 } 372 function keydown(e) { 373 for (var i = rockthemes.events.scroll_keys.length; i--;) { 374 if (e.keyCode === rockthemes.events.scroll_keys[i]) { 375 rockthemes_preventDefault(e); 376 return; 377 } 378 } 379 } 380 function wheel(e) { 381 rockthemes_preventDefault(e); 382 } 383 384} 385 386 387 388function rockthemes_activate_animations(){ 389 if(!jQuery('.rockthemes-animate').length) return; 390 391 /* 392 ** Disable animations for mobile devices 393 ** 394 */ 395 if(Modernizr.ismobile || !Modernizr.cssanimations){ 396 jQuery('.rockthemes-animate').removeClass('rockthemes-animate'); 397 return; 398 } 399 400 401 var ended_events = 'animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd'; 402 403 jQuery('.rockthemes-animate').each(function(){ 404 var that = jQuery(this); 405 that.appear(); 406 that.on('appear', function(){ 407 //Avoid firing again and overload on scroll event. 408 that.off('appear'); 409 that.appearOff(); 410 411 //Delay the animation 412 setTimeout(function(){ 413 if(that.find('img').length){ 414 that.imagesLoaded(function(){ 415 setTimeout(function(){ 416 activate_animate_animation(that, ended_events); 417 },180); 418 });
419 }else{ 420 activate_animate_animation(that, ended_events); 421 } 422 }, parseInt(that.attr('data-animation-delay-time'))); 423 424 }); 425 }); 426} 427 428function activate_animate_animation(that, ended_events){ 429 that.addClass(that.attr('data-animation-class')+' animated'); 430 431 if(that.find(".rockthemes-list").length){ 432 rockthemes_ea_list(that, that.attr('data-animation-class')+' animated'); 433 } 434 435 that.on(ended_events, function(){ 436 that.removeClass('rockthemes-animate '+that.attr('data-animation-class')+' animated'); 437 438 that.off(ended_events); 439 }); 440} 441 442//Elements Animation : ea. 443function rockthemes_ea_list(el,anim){ 444 //Use el references instead of "that". Because we use "that" in the setTimeout loop below. 445 el.find("li").css("opacity","0"); 446 447 var latest_i = 0; 448 el.find(" ul > li").each(function(i){ 449 var that = jQuery(this); 450 setTimeout(function(){ 451 that.addClass(anim); 452 }, 300 * i); 453 latest_i = i; 454 }); 455} 456 457 458 459 460 461function rockthemes_woocommerce_elements_init(){ 462 //WooCommerce Review Tab - Open from the link above title 463 jQuery(document).on("click", ".woocommerce-review-link", function(){ 464 var tab_id = jQuery(this).attr('href'); 465 var content = jQuery(tab_id+'.rock-tab-header') 466 if(typeof content == 'undefined' || content.length < 1) return; 467 content.trigger('click'); 468 }); 469 470 471} 472 473 474 475 476function rocktheme_wrap_iframe_videos(){ 477 var elems = ['iframe','embed', 'video', '.video-player']; 478 var dismiss = ['.fp-player', '.flowplayer-video', '.curvyslider-video']; 479 for (var i = 0; i < elems.length; i++){ 480 jQuery(elems[i]).each(function(){; 481 var that = jQuery(this), 482 dismissed = false; 483 484 //Oauth Escape 485 if(that.parent().is('body') || that.parent().is('html')){ 486 return; 487 } 488 489 for(var d = 0; d<dismiss.length; d++){ 490 if(that.parents(dismiss[d]).length){ 491 dismissed = true; 492 } 493 } 494 495 if(!that.parents('.azoom-iframe-container').length && !that.parent().hasClass('rockthemes-background-video') && !dismissed){ 496 that.wrap('<div class="azoom-iframe-container"></div>'); 497 } 498 }); 499 } 500} 501 502 503 504//Helper function. Currently disabled but might be useful on updates. 505function rockthemes_extend_modernizr(){ 506 //Extend Modernizr 507 if(Modernizr){ 508 Modernizr.addTest('ipad', function () { 509 return !!navigator.userAgent.match(/iPad/i); 510 }); 511 512 Modernizr.addTest('iphone', function () { 513 return !!navigator.userAgent.match(/iPhone/i); 514 }); 515 516 Modernizr.addTest('ipod', function () { 517 return !!navigator.userAgent.match(/iPod/i); 518 }); 519 520 Modernizr.addTest('appleios', function () { 521 return (Modernizr.ipad || Modernizr.ipod || Modernizr.iphone); 522 }); 523 524 Modernizr.addTest('android', function () { 525 return !!navigator.userAgent.match(/Android/i); 526 }); 527 528 Modernizr.addTest('iemobile', function () { 529 return !!navigator.userAgent.match(/IEMobile/i); 530 }); 531 532 Modernizr.addTest('ismobile', function () { 533 return (Modernizr.ipad || Modernizr.ipod || Modernizr.iphone || Modernizr.android || Modernizr.iemobile); 534 }); 535 } 536 537} 538 539/*Activate Elements*/ 540function rockthemes_activate_elements_js(){ 541 542 //Toggles 543 if(jQuery('.rock-toggles-container').length){ 544 rockthemes_ae_toggles(); 545 } 546 547 //Tabs 548 if(jQuery('.rock-tabs-container').length){ 549 rockthemes_ae_tabs(); 550 } 551 552 //Achievement 553 if(jQuery('.rock-achievement').length){ 554 rockthemes_ae_achievement(); 555 } 556 557 //Iconic Text 558 if(jQuery('.rock-iconictext-container').length){ 559 rockthemes_ae_iconictext(); 560 } 561 562 //Button 563 if(jQuery('.button[data-button-js-colors="true"]').length){ 564 rockthemes_ae_buttons(); 565 } 566 567 //Steps 568 if(jQuery('.azoom-steps').length){ 569 rockthemes_ae_steps(); 570 } 571 572 //Skills 573 if(jQuery('.azoom-skill').length){ 574 rockthemes_ae_skills(); 575 } 576 577 //Love 578 if(jQuery('.azoom-love-icon').length){ 579 rockthemes_ae_love_icon(); 580 } 581 582 //References 583 if(jQuery('.rock-references-builder').length){ 584 rockthemes_ae_references(); 585 } 586 587 //Alert Boxes 588 if(jQuery('.alert-box').length){ 589 rockthemes_ae_alertbox(); 590 } 591 592 //Team Members 593 if(jQuery('.azoom-team-members').length){ 594 rockthemes_ae_teammembers(); 595 } 596 597 //Image element 598 if(jQuery('.azoom-single-image').length){ 599 rockthemes_ae_singleimage(); 600 } 601 602} 603 604 605//Activate Elements - Single Image 606function rockthemes_ae_singleimage(){ 607 if(jQuery('.azoom-overflow-image').length){ 608 rockthemes_overflow_image(); 609 jQuery(window).smartresize(rockthemes_overflow_image); 610 } 611 612 if(jQuery('.azoom-snap-image').length){ 613 rockthemes_snap_image(); 614 jQuery(window).smartresize(rockthemes_snap_image); 615 } 616} 617 618function rockthemes_overflow_image(){ 619 jQuery('.azoom-overflow-image').each(function(){ 620 if(jQuery(window).width() <= 800){ 621 jQuery(this).css({'bottom':''}); 622 return; 623 } 624 625 jQuery(this).parents('.columns').css({'min-height':'10px'}); 626 627 var image = jQuery(this), 628 sg = jQuery(this).parents('.rockthemes-unique-grid'), 629 vs = typeof sg !== 'undefined' ? sg.hasClass('rsb-vertical-space') : false, 630 df = parseInt(image.attr('data-overflow')), 631 th = image.parents('.row').outerHeight(true) + df - image.parents('.columns').outerHeight(); 632 633 if(vs && !image.parents('.row').hasClass('rsb-vertical-space')){ 634 th += 105; 635 }else if(vs){ 636 th -= 105; 637 } 638 639 640 image.css({ 641 'bottom':'-'+th+'px' 642 }); 643 }); 644} 645 646 647 648function rockthemes_snap_image(){ 649 jQuery('.azoom-snap-image').each(function(){ 650 jQuery(this).css({'left':'','right':''}); 651 652 if(jQuery(window).width() <= 800){ 653 return; 654 } 655 656 var image = jQuery(this), 657 m = jQuery(this).parents('.main-container').length ? jQuery(this).parents('.main-container') : jQuery('body'), 658 ds = image.attr('data-snap-image'), 659 snap = 0, 660 le = image.hasClass('azoom-overflow-image') ? parseInt(image.parent().css('padding-left')) : 0; 661 662 663 switch(ds){ 664 case 'left': 665 snap = m.offset().left - image.offset().left + le; 666 image.css({ 667 'left':snap+'px' 668 }); 669 break; 670 671 case 'right': 672 image.imagesLoaded(function(){
673 snap = -((m.offset().left + m.width()) - (image.offset().left + image.width()) + le); 674 image.css({ 675 'right':snap+'px' 676 }); 677 }); 678 break; 679 } 680 681 }); 682} 683 684 685 686 687//Activate Elements - Team Members 688function rockthemes_ae_teammembers(){ 689 jQuery('.azoom-team-members').each(function(){ 690 var that = jQuery(this); 691 692 that.find('.team-member-article').click(function(e){ 693 e.preventDefault(); 694 var id = jQuery(this).parents('.azoom-team-members').attr('id'); 695 var no_slide = false; 696 697 698 var content = jQuery(this).find('.member-details').clone(); 699 700 //Remove any fixed overlay if exists 701 if(jQuery('.'+id).length){ 702 no_slide = true; 703 jQuery('.'+id).empty(); 704 jQuery('.'+id).append(jQuery('<div class="team-member-box-close">×</div>')); 705 jQuery('.'+id).append(content); 706 }else{ 707 var box = jQuery('<div class="team-member-box '+id+'"><div class="team-member-box-close">×</div></div>'); 708 box.append(content); 709 that.prepend(box); 710 that.find('.team-member-box').slideDown(); 711 } 712 713 var go_top = parseInt(jQuery('.'+id).offset().top) - 30; 714 if(jQuery('.header-sticky-active').length){ 715 go_top = go_top - parseInt(rockthemes.menu.sticky_height); 716 } 717 718 if(jQuery('#wpadminbar').length){ 719 go_top = go_top - parseInt(jQuery('#wpadminbar').height()); 720 } 721 722 jQuery('html, body').animate({scrollTop:go_top},1000); 723 724 jQuery(document).on('click touchend', '.team-member-box-close',function(){ 725 var that_tm = jQuery(this).parents('.team-member-box'); 726 //Remove any fixed overlay if exists 727 if(that_tm.length){ 728 that_tm.slideUp(480, function(){ 729 if(that_tm.length){ 730 that_tm.remove(); 731 } 732 }); 733 } 734 }); 735 }); 736 }); 737} 738 739 740 741 742//Activate Element - Alert Box 743function rockthemes_ae_alertbox(){ 744 jQuery('.alert-box').each(function(){ 745 var that = jQuery(this); 746 if(that.find('.alert-box-close').length){ 747 that.on("click touchend", ".alert-box-close", function(){ 748 that.slideUp(); 749 }); 750 } 751 }); 752} 753 754 755//Activate Elements - References 756function rockthemes_ae_references(){ 757 jQuery('.rock-references-builder').each(function(){ 758 var that = jQuery(this); 759 that.rock_ref = new Object(); 760 that.rock_ref.time = parseInt(that.attr('data-time')); 761 that.rock_ref.id = that.attr('id'); 762 that.rock_ref.timer; 763 that.rock_ref.current_row = 0; 764 that.rock_ref.total_in_row = that.attr('data-total-in-row'); 765 that.rock_ref.auto_slide = that.attr('data-auto-slide'); 766 767 768 that.rock_ref.total_rows = jQuery('#'+that.rock_ref.id+' ul').length; 769 770 if(that.rock_ref.auto_slide == 'true'){ 771 that.rock_ref.timer = setInterval(function(){ 772 change_references(false,that); 773 }, that.rock_ref.time); 774 } 775 776 jQuery('#'+that.rock_ref.id+' ul').each(function(i){ 777 jQuery(this).css({'margin-top':'-'+jQuery(this).position().top+'px'}); 778 }); 779 780 jQuery(document).on('click', '#'+that.rock_ref.id+' .references_previous_button', function(){ 781 if(that.rock_ref.auto_slide == 'true'){ 782 clearInterval(that.rock_ref.timer); 783 } 784 785 786 change_references(true,that); 787 if(that.rock_ref.auto_slide == 'true'){ 788 that.rock_ref.timer = setInterval(function(){ 789 change_references(true,that); 790 }, that.rock_ref.time); 791 } 792 }); 793 794 jQuery(document).on('click', '#'+that.rock_ref.id+' .references_next_button', function(){ 795 if(that.rock_ref.auto_slide == 'true'){ 796 clearInterval(that.rock_ref.timer); 797 } 798 799 change_references(false,that); 800 801 if(that.rock_ref.auto_slide == 'true'){ 802 that.rock_ref.timer = setInterval(function(){ 803 change_references(false,that); 804 }, that.rock_ref.time); 805 } 806 }); 807 808 var first_time = false; 809 810 that.imagesLoaded(function(){ 811 rockthemes_references_resize(that.rock_ref.id, first_time); 812 }); 813 814 jQuery(window).smartresize(function(){ 815 rockthemes_references_resize(that.rock_ref.id, first_time); 816 }); 817 818 819 }); 820} 821function rockthemes_references_resize(id, first_time){ 822 jQuery('#'+id+' .absolute-class').first().find('li').css('margin-top','0'); 823 var height = jQuery('#'+id+' .absolute-class').first().height(); 824 825 jQuery('#'+id+' .rock-references-content').css('height',height); 826 if(!first_time){ 827 height = jQuery('#'+id+' .absolute-class').first().find('li').first().height(); 828 jQuery('#'+id+' .azoom-element-responsive-header').css({top: height/ 2 - 13}); 829 first_time = true; 830 } 831} 832function change_references(previous,that){ 833 //Hide current references 834 jQuery('#'+that.rock_ref.id+' .absolute-class').eq(that.rock_ref.current_row).find('li').each(function(i){ 835 jQuery(this).stop(true,true).animate({'margin-top':'-30px', 'opacity':'0'}, (i * 200) + 100); 836 }); 837 838 jQuery('#'+that.rock_ref.id+' .absolute-class').eq(that.rock_ref.current_row).css({'zIndex':'0'}); 839 840 if(typeof previous !== 'undefined' && previous === true){ 841 that.rock_ref.current_row--; 842 843 if(that.rock_ref.current_row < 0){ 844 that.rock_ref.current_row = that.rock_ref.total_rows - 1; 845 } 846 }else{ 847 that.rock_ref.current_row++; 848 849 if(that.rock_ref.current_row >= that.rock_ref.total_rows){ 850 that.rock_ref.current_row = 0; 851 } 852 } 853 854 jQuery('#'+that.rock_ref.id+' .absolute-class').eq(that.rock_ref.current_row).css({'zIndex':'1'}); 855 856 857 jQuery('#'+that.rock_ref.id+' .absolute-class').eq(that.rock_ref.current_row).find('li').each(function(i){ 858 jQuery(this).css({'margin-top':'60px'}); 859 jQuery(this).stop(true,true).animate({'margin-top':'0px', 'opacity':'1'}, (i * 150) + 250); 860 }); 861} 862 863 864 865 866 867 868 869 870//Activate Elements - Skills 871function rockthemes_ae_skills(){ 872 // Single Element 873 jQuery('.azoom-skill').each(function(){ 874 var that = jQuery(this); 875 876 if(that.parents('.rockthemes-animate.skill-animating').length){ 877 878 return; 879 }else if(that.parents('.rockthemes-animate').length){ 880 881 that.parents('.rockthemes-animate').addClass('skill-animating'); 882 var r = that.parents('.rockthemes-animate.skill-animating');
883 r.appear(); 884 r.on('appear', function(){ 885 r.off('appear'); 886 r.appearOff(); 887 r.find('.azoom-skill').each(function(i){ 888 var t = jQuery(this); 889 if(!t.find('.active').length){ 890 if(Modernizr.csstransitions){ 891 setTimeout(function(){ 892 t.addClass('active'); 893 t.off('appear'); 894 t.appearOff(); 895 }, parseInt(i * 600)); 896 }else{ 897 t.addClass('active'); 898 t.off('appear'); 899 t.appearOff(); 900 } 901 } 902 }); 903 }); 904 905 }else{ 906 907 that.appear(); 908 909 that.on('appear', function(){ 910 if(!that.find('.active').length){ 911 setTimeout(function(){ 912 that.addClass('active'); 913 that.off('appear'); 914 that.appearOff(); 915 },600); 916 } 917 }); 918 } 919 }); 920 921} 922 923 924//Activate Elements - Love Icon 925function rockthemes_ae_love_icon(){ 926 927 jQuery(document).on('click touchend', '.azoom-love-icon', function(e){ 928 e.preventDefault(); 929 930 var that = jQuery(this); 931 if(typeof that.attr('data-loved-this') !== 'undefined' && 932 that.attr('data-loved-this') && 933 that.attr('data-loved-this') === 'yes'){ 934 935 //Loved this already :) 936 return; 937 } 938 939 if(typeof that.attr('data-post-id') !== 'undefined' && that.attr('data-post-id') && that.attr('data-post-id') !== ''){ 940 var sd = {post_id:that.attr('data-post-id')};// sd = Send Data 941 jQuery.post(rockthemes.ajaxurl, {action:'azoom_love_ajax', _ajax_nonce:rockthemes.nonces.love, data:sd}, 942 function(data){ 943 944 945 if(data == 'success'){ 946 var n = jQuery('.azoom-love-icon[data-post-id="'+that.attr('data-post-id')+'"]').attr('data-loved-this', 'yes'); 947 if(n.find('span').length){ 948 n.find('span').html(parseInt(n.find('span').html()) + 1); 949 } 950 } 951 } 952 ); 953 } 954 }); 955} 956 957 958//Activate Elements - Steps 959function rockthemes_ae_steps(){ 960 961 rockthemes_ae_steps_init_resize(); 962 jQuery(window).smartresize(rockthemes_ae_steps_init_resize); 963 964 jQuery('.azoom-steps .step-icon').click(function(){ 965 rockthemes_se_elem_clicked(jQuery(this)); 966 }); 967 968 969 jQuery('.azoom-steps').each(function(){ 970 var that = jQuery(this); 971 var size = (parseInt(that.attr('data-min-width')) / that.find('li').length); 972 973 var starting_x = 0;//e.originalEvent.touches[0].pageX; 974 var ending_x = 0; 975 var matrix = (that.css("transform")).substr(7, (that.css("transform")).length - 8).split(', '); 976 var last_size = matrix[4]; 977 978 var first_x_val = -(parseInt(that.find('li').first().offset().left + ((parseInt(that.attr('data-min-width')) / that.find('li').length) / 2)) - 35); 979 //We have used .position() in desktop version. Haven't tested it on mobile version. Mobile version might need this change as well. 980 first_x_val = first_x_val + Number(last_size); 981
982 var first_x_val_desk = -(parseInt(that.find('li').first().position().left + ((parseInt(that.attr('data-min-width')) / that.find('li').length) / 2)) - 35); 983 first_x_val_desk = first_x_val_desk + Number(last_size); 984 985 that.on('touchstart', function(e){ 986 starting_x = e.originalEvent.touches[0].pageX; 987 ending_x = parseInt(starting_x - e.originalEvent.touches[0].pageX); 988 matrix = (that.css("transform")).substr(7, (that.css("transform")).length - 8).split(', '); 989 last_size = matrix[4]; 990 that.removeClass('azoom-transition'); 991 }).on("touchmove", function(e){ 992 e.preventDefault(); 993 ending_x = parseInt(starting_x - e.originalEvent.touches[0].pageX); 994 var diff = parseInt(last_size - ending_x); 995 996 if(Math.abs(ending_x) < 5)return; 997 // 998 that.css({ 999 'transform':'translateX('+diff+'px)', 1000 '-webkit-transform':'translateX('+diff+'px)' 1001 }); 1002 }).on("touchend", function(e){ 1003 that.addClass('azoom-transition'); 1004 if(Math.abs(ending_x) < 5) return; 1005 1006 var diff = parseInt(last_size - ending_x); 1007 1008 var new_val = parseInt(last_size) - (ending_x + (size - ((ending_x) % size))); 1009 if(ending_x < 0){ 1010 new_val = parseInt(new_val) + (size * 2); 1011 } 1012 1013 1014 if(new_val < -(parseInt(that.attr('data-min-width')) - (size / 2))){ 1015 new_val = first_x_val; 1016 }else if( new_val > (first_x_val - 10)){ 1017 new_val = first_x_val; 1018 } 1019 1020 1021 that.css({ 1022 'transform':'translateX('+new_val+'px)', 1023 '-webkit-transform':'translateX('+new_val+'px)' 1024 }); 1025 1026 }); 1027 1028 1029 1030 that.on('mousedown', function(e){ 1031 that.addClass('mousedown'); 1032 starting_x = e.pageX - that.offset().left; 1033 ending_x = parseInt(starting_x - (e.pageX - that.offset().left)); 1034 matrix = (that.css("transform")).substr(7, (that.css("transform")).length - 8).split(', '); 1035 last_size = matrix[4]; 1036 that.removeClass('azoom-transition'); 1037 }); 1038 1039 jQuery('body').on("mousemove", function(e){ 1040 1041 if(!that.hasClass('mousedown')){ 1042 return true; 1043 } 1044 1045 e.preventDefault(); 1046 e.stopPropagation(); 1047 1048 ending_x = parseInt(starting_x - (e.pageX - that.offset().left)); 1049 var diff = parseInt(last_size - ending_x); 1050 1051 if(Math.abs(ending_x) < 5)return; 1052 1053 that.css({ 1054 'transform':'translateX('+diff+'px)', 1055 '-webkit-transform':'translateX('+diff+'px)' 1056 }); 1057 }); 1058 jQuery('body').on("mouseup", function(e){ 1059 1060 if(!that.hasClass('mousedown')) return; 1061 1062 e.preventDefault(); 1063 that.removeClass('mousedown'); 1064 1065 that.addClass('azoom-transition'); 1066 if(Math.abs(ending_x) < 5) return; 1067 1068 1069 var diff = parseInt(last_size - ending_x); 1070 1071 var new_val = parseInt(last_size) - (ending_x + (size - ((ending_x) % size))); 1072 if(ending_x < 0){ 1073 new_val = parseInt(new_val) + (size * 2); 1074 } 1075 1076 1077 if(new_val < -(parseInt(that.attr('data-min-width')) - (size / 2))){ 1078 new_val = first_x_val_desk; 1079 }else if( new_val > (first_x_val_desk - 10)){ 1080 new_val = first_x_val_desk; 1081 } 1082 1083 1084 that.css({ 1085 'transform':'translateX('+new_val+'px)', 1086 '-webkit-transform':'translateX('+new_val+'px)' 1087 }); 1088 1089 }); 1090 1091 1092 }); 1093 1094 1095 1096 jQuery('.azoom-steps .step-back').click(function(e){ 1097 var t_steps = jQuery(this).parents('.azoom-steps'); 1098 if(t_steps.parent().width() < parseInt(t_steps.attr('data-min-width')) && t_steps.find('li.active').length > 1){ 1099 var size = t_steps.find('li').first().width() + 20;//parseInt(t_steps.width() / t_steps.find('li').length); 1100 var matrix = (t_steps.css("transform")).substr(7, (t_steps.css("transform")).length - 8).split(', '); 1101 var last_size = matrix[4]; 1102 t_steps.css({ 1103 'transform': 'translateX('+(parseInt(last_size) + size)+'px)', 1104 '-webkit-transform': 'translateX('+(parseInt(last_size) + size)+'px)', 1105 '-ms-transform': 'translateX('+(parseInt(last_size) + size)+'px)', 1106 }); 1107 } 1108 1109 rockthemes_se_elem_clicked(jQuery(this).parents('li').find('.step-icon')); 1110 if(jQuery(this).parents('li').prev().length && jQuery(this).parents('li').prev().hasClass('done')){ 1111 jQuery(this).parents('li').prev().removeClass('done'); 1112 } 1113 }); 1114 1115 jQuery('.azoom-steps .step-next').click(function(e){ 1116 var t_steps = jQuery(this).parents('.azoom-steps'); 1117 if(t_steps.parent().width() < parseInt(t_steps.attr('data-min-width')) && t_steps.find('li.active').length < t_steps.find('li').length){ 1118 var size = t_steps.find('li').first().width() + 20;//parseInt(t_steps.width() / t_steps.find('li').length); 1119 var matrix = (t_steps.css("transform")).substr(7, (t_steps.css("transform")).length - 8).split(', '); 1120 var last_size = matrix[4]; 1121 t_steps.css({ 1122 'transform': 'translateX('+(parseInt(last_size) - size)+'px)',
1123 '-webkit-transform': 'translateX('+(parseInt(last_size) - size)+'px)', 1124 '-ms-transform': 'translateX('+(parseInt(last_size) - size)+'px)', 1125 }); 1126 } 1127 1128 if(jQuery(this).parents('li').next().length){ 1129 rockthemes_se_elem_clicked(jQuery(this).parents('li').next().find('.step-icon')); 1130 } 1131 }); 1132 1133 1134 jQuery('.azoom-steps').each(function(){ 1135 var that = jQuery(this); 1136 if(that.attr('data-start_steps') === 'none') return; 1137 1138 that.appear(); 1139 1140 that.on('appear', function(){ 1141 if(!that.find('.active').length){ 1142 if(!Modernizr.touch && that.attr('data-start_steps') === 'all' && parseInt(that.attr('data-min-width')) < jQuery(window).width()){ 1143 rockthemes_se_elem_clicked(that.find('li .step-icon')); 1144 }else{ 1145 rockthemes_se_elem_clicked(that.find('li').first().find('.step-icon')); 1146 } 1147 that.off('appear'); 1148 that.appearOff(); 1149 } 1150 }); 1151 }); 1152 1153} 1154function rockthemes_ae_steps_init_resize(){ 1155 //Init Steps 1156 jQuery('.azoom-steps').each(function(){ 1157 var data_width = typeof jQuery(this).attr('data-min-width') !== '' && jQuery(this).attr('data-min-width') !== '' ? parseInt(j
1157Query(this).attr('data-min-width')) : 960; 1158 if(parseInt(jQuery(this).find(' > ul > li').length % 2) === 0){ 1159 data_width += jQuery(this).find(' > ul > li').first().width(); 1160 } 1161 1162 1163 if(jQuery(this).parent().width() < parseInt(data_width)){ 1164 var f = jQuery(this).find('li').first(); 1165 var x_val = -(parseInt( ((parseInt(jQuery(this).attr('data-min-width')) / jQuery(this).find('li').length) / 2)) - 35); 1166 1167 1168 1169 if(jQuery(this).hasClass('responsive')){ 1170 var matrix = (jQuery(this).css("transform")).substr(7, (jQuery(this).css("transform")).length - 8).split(', '); 1171 var last_size = matrix[4]; 1172 1173 } 1174 1175 jQuery(this).addClass('responsive'); 1176 jQuery(this).css({ 1177 'min-width':jQuery(this).attr('data-min-width')+'px', 1178 'transform':'translateX('+x_val+'px)', 1179 '-webkit-transform':'translateX('+x_val+'px)', 1180 '-moz-transform':'translateX('+x_val+'px)', 1181 '-ms-transform':'translateX('+x_val+'px)' 1182 }); 1183 }else if(jQuery(this).hasClass('responsive')){ 1184 jQuery(this).removeClass('responsive'); 1185 jQuery(this).css({ 1186 'transform':'translateX(0px)', 1187 '-webkit-transform':'translateX(0px)', 1188 '-moz-transform':'translateX(0px)', 1189 '-ms-transform':'translateX(0px)' 1190 }); 1191 } 1192 }); 1193} 1194function rockthemes_se_elem_clicked(elem){ 1195 var that = elem.parents('li'); 1196 var steps = that.parents('.azoom-steps'); 1197 var start_class = steps.attr('class'); 1198 1199 1200 1201 if(steps.hasClass('connect-steps')){ 1202 var this_i = that.parents('ul').find('li').index(that); 1203 var not_connected = false; 1204 1205 //Check if all elements till this has activated 1206 for(var b = 0; b < this_i; b++){ 1207 if(!steps.find('li').eq(b).hasClass('active')){ 1208 not_connected = true; 1209 break; 1210 } 1211 } 1212 1213 for(var a = this_i + 1; a < steps.find('li').length; a++){ 1214 if(steps.find('li').eq(a).hasClass('active')){ 1215 not_connected = true; 1216 break; 1217 } 1218 } 1219 1220 if(not_connected){ 1221 return; 1222 } 1223 } 1224 1225 that.toggleClass('active'); 1226 1227 if(that.hasClass('done')){ 1228 that.removeClass('done'); 1229 } 1230 1231 if(that.hasClass('active')){ 1232 elem.css({'background-color':that.attr('data-step-color')}); 1233 that.css({'background-color':that.attr('data-step-color')}); 1234 that.find('.step-details-line').css({'background-color':that.attr('data-step-color')}); 1235 if(that.index() % 2 === 0){ 1236 that.parents('.azoom-steps').addClass('azoom-steps-margin-bottom'); 1237 }else{ 1238 that.parents('.azoom-steps').addClass('azoom-steps-margin-top'); 1239 } 1240 }else{ 1241 elem.css({'background-color':''}); 1242 that.css({'background-color':''}); 1243 that.find('.step-details-line').css({'background-color':''}); 1244 } 1245 1246 if(elem.parents('.azoom-steps').hasClass('jump-steps')){ 1247 //Check back steps 1248 if(that.hasClass('active')){ 1249 for(var i = 0; i< that.parents('ul').find('li').index(that); i++){ 1250 1251 steps.find('li:eq('+i+')').find('.step-icon').css({'background-color':steps.find('li:eq('+i+')').attr('data-step-color')}); 1252 steps.find('li:eq('+i+')').css({'background-color':steps.find('li:eq('+i+')').attr('data-step-color')}); 1253 steps.find('li:eq('+i+')').find('.step-details-line').css({'background-color':steps.find('li:eq('+i+')').attr('data-step-color')}); 1254 steps.find('li:eq('+i+')').addClass('active done'); 1255 1256 if(i % 2 === 0){ 1257 steps.addClass('azoom-steps-margin-bottom'); 1258 }else{ 1259 steps.addClass('azoom-steps-margin-top'); 1260 } 1261 } 1262 1263 }else{ 1264 for(var t = that.parents('ul').find('li').index(that); t < steps.find('li').length; t++){ 1265 1266 steps.find('li:eq('+t+')').removeClass('active done'); 1267 steps.find('li:eq('+t+')').find('.step-icon').css({'background-color':''}); 1268 steps.find('li:eq('+t+')').css({'background-color':''}); 1269 steps.find('li:eq('+t+')').find('.step-details-line').css({'background-color':''}); 1270 } 1271 } 1272 }else{ 1273 if(that.prev().length){ 1274 that.prev().addClass('done'); 1275 } 1276 } 1277 1278 1279 1280 if(!that.parents('.azoom-steps').find('.active').length){ 1281 that.parents('.azoom-steps').removeClass('azoom-steps-margin-top azoom-steps-margin-bottom'); 1282 } 1283 1284} 1285 1286 1287 1288 1289//Activate Elements - Button 1290function rockthemes_ae_buttons(){ 1291 jQuery('.button[data-button-js-colors="true"]').each(function(){ 1292 var that = jQuery(this); 1293 that.on('mouseenter', function(){ 1294 var btn = jQuery(this); 1295 var bg_hover = btn.attr('data-bg_color_hover'); 1296 var text_hover = btn.attr('data-text_color_hover'); 1297 var border_hover = btn.attr('data-border_color_hover'); 1298 1299 if(btn.attr("data-bg-disabled") && btn.attr("data-bg-disabled") == "true"){ 1300 that.css({'border-color':border_hover, 'color':text_hover, 'background':bg_hover}); 1301 }else if(btn.hasClass('button-border-bottom')){ 1302 that.css({'background':bg_hover, 1303 'box-shadow':'0px 3px 0px '+border_hover, 1304 '-webkit-box-shadow':'0px 3px 0px '+border_hover, 1305 '-moz-box-shadow':'0px 3px 0px '+border_hover, 1306 'color':text_hover}); 1307 }else{ 1308 that.css({'background':bg_hover, 'color':text_hover}); 1309 } 1310 }); 1311 1312 that.on('mouseleave', function(){ 1313 var btn = jQuery(this); 1314 var bg_default = btn.attr("data-bg_color_default"); 1315 var text_default = btn.attr("data-text_color_default"); 1316 var border_color = btn.attr('data-border_color'); 1317 1318 if(btn.attr("data-bg-disabled") && btn.attr("data-bg-disabled") == "true"){ 1319 that.css({'border-color':border_color, 'color':text_default, 'background':'none'}); 1320 }else if(btn.hasClass('button-border-bottom')){ 1321 that.css({'background':bg_default, 1322 'box-shadow':'0px 6px 0px '+border_color, 1323 '-webkit-box-shadow':'0px 6px 0px '+border_color, 1324 '-moz-box-shadow':'0px 6px 0px '+border_color, 1325 'color':text_default}); 1326 }else{ 1327 that.css({'background':bg_default, 'color':text_default}); 1328 } 1329 }); 1330 }); 1331 1332 1333 1334 //Iframe Modal Buttons 1335 jQuery(document).trigger('rockthemes:activate_lightbox'); 1336} 1337 1338 1339 1340 1341//Activate Elements - Iconic Text 1342function rockthemes_ae_iconictext(){ 1343 jQuery('.rock-iconictext-container').each(function(){ 1344 var that = jQuery(this); 1345 1346 if(that.hasClass('full-width-box') && that.hasClass('top')){ 1347 //Do not do anything. Because it's effect will be handled via CSS3 1348 return; 1349 } 1350 1351 that.on('mouseenter', function(){ 1352 var icon = jQuery(this).find('.rockicon-container'); 1353 var bg_color = icon.attr('data-bg-color'); 1354 var bg_hover_color = icon.attr('data-bg-hover-color'); 1355 var icon_color = icon.attr('data-icon-color'); 1356 var icon_hover_color = icon.attr('data-icon-hover-color'); 1357 1358 if(typeof icon.attr('data-box-fill') != 'undefined' && icon.attr('data-box-fill').indexOf('border') > -1){ 1359 icon.stop(true,true).animate({"border-color":bg_hover_color, "color":icon_hover_color},180); 1360 }else if(icon.attr("data-bg-disabled") && icon.attr("data-bg-disabled") == "true"){ 1361 icon.stop(true,true).animate({"color":icon_hover_color},280); 1362 }else{ 1363 icon.stop(true,true).animate({"backgroundColor":bg_hover_color, "color":icon_hover_color},180); 1364 } 1365 }); 1366 1367 that.on('mouseleave', function(){ 1368 var icon = jQuery(this).find(".rockicon-container"); 1369 var bg_color = icon.attr('data-bg-color'); 1370 var bg_hover_color = icon.attr('data-bg-hover-color'); 1371 var icon_color = icon.attr('data-icon-color'); 1372 var icon_hover_color = icon.attr('data-icon-hover-color'); 1373 1374 if(typeof icon.attr('data-box-fill') != 'undefined' && icon.attr('data-box-fill').indexOf('border') > -1){ 1375 icon.stop(true,true).animate({"border-color":bg_color, "color":icon_color},180); 1376 }else if(icon.attr("data-bg-disabled") && icon.attr("data-bg-disabled") == "true"){ 1377 icon.stop(true,true).animate({"color":icon_color},180); 1378 }else{ 1379 icon.stop(true,true).animate({"backgroundColor":bg_color, "color":icon_color},180); 1380 } 1381 }); 1382 }); 1383} 1384 1385 1386 1387 1388 1389//Activate Elements - Achievement 1390function rockthemes_ae_achievement(){ 1391 1392 1393 jQuery('.rock-achievement').each(function(){ 1394 var that = jQuery(this), 1395 that_id = that.attr('id')+'_number', 1396 achievement = jQuery('#'+that_id);; 1397 1398 /* 1399 ** Disable Achievement Odometer on mobile devices 1400 */ 1401 if(Modernizr.ismobile){ 1402 achievement.removeClass('odometer'); 1403 } 1404 1405 switch(that.data('mode')){ 1406 case 'static': 1407 if(Modernizr.ismobile){ 1408 achievement.html(that.attr('data-value')); 1409 }else{ 1410 that.appear(); 1411 jQuery(document).on('appear', '#'+that.attr('id'), function(){ 1412 //Set a little delay. This will fix the trigger 1413 var u = new CountUp(that_id, 0, that.attr('data-value')); 1414 u.start(); 1415 1416 jQuery(document).off('appear', '#'+that.attr('id')); 1417 that.appearOff(); 1418 });
1419 } 1420 break; 1421 1422 case 'function_php': 1423 if(Modernizr.ismobile){ 1424 achievement.html(that.attr('data-value')); 1425 }else{ 1426 that.appear(); 1427 jQuery(document).on('appear', '#'+that.attr('id'), function(){ 1428 var u = new CountUp(that_id, 0, that.attr('data-value')); 1429 u.start(); 1430 jQuery(document).off('appear', '#'+that.attr('id')); 1431 that.appearOff(); 1432 }); 1433 } 1434 break; 1435 1436 case 'function_js': 1437 if(!Modernizr.ismobile){ 1438 that.appear(); 1439 } 1440 1441 var fn = window[that.data('function_js')]; 1442 1443 if(typeof fn === 'function'){ 1444 var number = fn(); 1445 if(Modernizr.ismobile){ 1446 achievement.html(number); 1447 }else{ 1448 jQuery(document).on('appear', '#'+that.attr('id'), function(){ 1449 var u = new CountUp(that_id, 0, number); 1450 u.start(); 1451 jQuery(document).off('appear', '#'+that.attr('id')); 1452 that.appearOff(); 1453 }); 1454 } 1455 } 1456 break; 1457 1458 case 'function_ajax': 1459 if(!Modernizr.ismobile){ 1460 that.appear(); 1461 } 1462 var fn = that.data('function_ajax'); 1463 var data = {function_name:fn}; 1464 if(Modernizr.ismobile){ 1465 jQuery.post(rockthemes.ajaxurl, {action:'rockthemes_achievement_ajax', _ajax_nonce:rockthemes.nonces.achievement, data:data}, function(data){ 1466 if(data && typeof data.number != 'undefined'){ 1467 achievement.html(data.number); 1468 } 1469 }); 1470 }else{ 1471 jQuery(document).on('appear', '#'+that.attr('id'), function(){ 1472 jQuery.post(rockthemes.ajaxurl, {action:'rockthemes_achievement_ajax', _ajax_nonce:rockthemes.nonces.achievement, data:data}, function(data){ 1473 if(data && typeof data.number != 'undefined'){ 1474 var u = new CountUp(that_id, 0, data.number); 1475 u.start(); 1476 } 1477 }); 1478 jQuery(document).off('appear', '#'+that.attr('id')); 1479 that.appearOff(); 1480 }); 1481 } 1482 break; 1483 1484 default : 1485 if(Modernizr.ismobile){ 1486 achievement.html(that.attr('data-value')); 1487 }else{ 1488 that.appear(); 1489 jQuery(document).on('appear', '#'+that.attr('id'), function(){ 1490 var u = new CountUp(that_id, 0, that.attr('data-value')); 1491 u.start(); 1492 jQuery(document).off('appear', '#'+that.attr('id')); 1493 that.appearOff(); 1494 }); 1495 } 1496 break; 1497 } 1498 1499 }); 1500} 1501 1502 1503 1504//Activate Elements - Tabs 1505function rockthemes_ae_tabs(){ 1506 jQuery('.rock-tabs-container').each(function(){ 1507 var tab = jQuery(this); 1508 var hash_on = tab.hasClass('tab-hash-active') ? true : false; 1509 1510 //Look for hashtag on the address bar 1511 var address_hash = location.hash; 1512 if(address_hash.indexOf("/") > -1){ 1513 address_hash = false; 1514 } 1515 if(typeof address_hash != 'undefined' && address_hash && tab.find(address_hash).length){ 1516 //Remove old active element\'s active class and hide it\'s content 1517 tab.find('.tabs-motion-content.active').css('display','none').removeClass('active'); 1518 tab.find('.rock-tab-header.active').removeClass('active'); 1519 1520 var ref = '#'+jQuery(address_hash).attr('data-tab-ref')+' .'+jQuery(address_hash).attr('data-content-ref'); 1521 var tabRef = jQuery(address_hash).attr('data-tab-ref'); 1522 1523 //Add new 1524 jQuery(address_hash).addClass('active'); 1525 jQuery(ref).css({'opacity':'0.1', 'display':'block'}).addClass('active'); 1526 jQuery(ref).stop(true,true).animate({'opacity':'1'},280); 1527 } 1528 1529 1530 tab.on('click touchend', '.rock-tab-header', function(e){ 1531 var ref = '#'+jQuery(this).attr('data-tab-ref')+' .'+jQuery(this).attr('data-content-ref'); 1532 var tabRef = jQuery(this).attr('data-tab-ref'); 1533 1534 //Remove old active element\'s active class and hide it\'s content 1535 jQuery('#'+tabRef+' .tabs-motion-content.active').css('display','none').removeClass('active'); 1536 jQuery('#'+tabRef+' .rock-tab-header.active').removeClass('active'); 1537 1538 //Add new 1539 jQuery(this).addClass('active'); 1540 jQuery(ref).css({'opacity':'0.1', 'display':'block'}).addClass('active'); 1541 jQuery(ref).stop(true,true).animate({'opacity':'1'},280); 1542 1543 //Deeplinking - ID for tab hash 1544 if(hash_on){ 1545 var this_hash = typeof jQuery(this).attr('id') != 'undefined' && jQuery(this).attr('id') ? jQuery(this).attr('id') : false; 1546 if(!this_hash) return; 1547 1548 setTimeout(function(){ 1549 if(history.pushState) { 1550 history.pushState(null, null, '#'+this_hash); 1551 }else { 1552 location.hash = this_hash; 1553 } 1554 },100); 1555 } 1556 }); 1557 }); 1558} 1559 1560 1561 1562//Activate Elements - Toggles 1563function rockthemes_ae_toggles(){ 1564 var icon_lib = (typeof rockthemes.fonts.use_icomoon != 'undefined' && rockthemes.fonts.use_icomoon === 'true') ? 'icomoon' : 'fontawesome'; 1565 var address_hash = location.hash; 1566 if(address_hash.indexOf("/") > -1){ 1567 address_hash = false; 1568 } 1569 1570 jQuery('.rock-toggles-container').each(function(){ 1571 var toggle = jQuery(this);
1572 var hash_on = toggle.hasClass('toggle-hash-active') ? true : false; 1573 1574 //Look for hashtag on the address bar 1575 if(typeof address_hash != 'undefined' && address_hash && toggle.find(address_hash).length){ 1576 1577 if(toggle.hasClass('multiple-mode')){ 1578 toggle.find('.active .rock-toggle-content').slideToggle(280); 1579 toggle.find('.active .rock-toggle-header .main-toggle-icon').removeClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-up6' : 'fa fa-chevron-up'); 1580 toggle.find('.active .rock-toggle-header .main-toggle-icon').addClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-down6' : 'fa fa-chevron-down'); 1581 toggle.find('.active').removeClass('active'); 1582 } 1583 1584 jQuery(address_hash).addClass('active'); 1585 jQuery(address_hash).find('.rock-toggle-content').slideToggle(280); 1586 jQuery(address_hash).find('.rock-toggle-header .main-toggle-icon').removeClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-down6' : 'fa fa-chevron-down'); 1587 jQuery(address_hash).find('.rock-toggle-header .main-toggle-icon').addClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-up6' : 'fa fa-chevron-up'); 1588 } 1589 1590 1591 //Multiple Toggle 1592 toggle.on('click touchend', '.rock-toggle-header', function(e){ 1593 e.preventDefault(); 1594 1595 if(toggle.hasClass('multiple-mode')){ 1596 if(jQuery(this).parent().hasClass('active') && jQuery(this).parent().find('.rock-toggle-content').css('display') != 'none') return; 1597 1598 toggle.find('.active .rock-toggle-content').slideToggle(280); 1599 toggle.find('.active .rock-toggle-header .main-toggle-icon').removeClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-up6' : 'fa fa-chevron-up'); 1600 toggle.find('.active .rock-toggle-header .main-toggle-icon').addClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-down6' : 'fa fa-chevron-down'); 1601 toggle.find('.active').removeClass('active'); 1602 1603 jQuery(this).parent().addClass('active'); 1604 jQuery(this).parent().find('.rock-toggle-content').slideToggle(280); 1605 jQuery(this).parent().find('.rock-toggle-header .main-toggle-icon').removeClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-down6' : 'fa fa-chevron-down'); 1606 jQuery(this).parent().find('.rock-toggle-header .main-toggle-icon').addClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-up6' : 'fa fa-chevron-up'); 1607 }else{ 1608 //Single Toggle 1609 if(jQuery(this).parent().hasClass('active')){ 1610 jQuery(this).parent().removeClass('active'); 1611 jQuery(this).parent().find('.rock-toggle-header .main-toggle-icon').removeClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-up6' : 'fa fa-chevron-up'); 1612 jQuery(this).parent().find('.rock-toggle-header .main-toggle-icon').addClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-down6' : 'fa fa-chevron-down'); 1613 }else{ 1614 jQuery(this).parent().addClass('active'); 1615 jQuery(this).parent().find('.rock-toggle-header .main-toggle-icon').removeClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-down6' : 'fa fa-chevron-down'); 1616 jQuery(this).parent().find('.rock-toggle-header .main-toggle-icon').addClass(icon_lib === 'icomoon' ? 'icomoon icomoon-icon-arrow-up6' : 'fa fa-chevron-up'); 1617 } 1618 jQuery(this).parent().find('.rock-toggle-content').slideToggle(280); 1619 } 1620 1621 1622 if(hash_on){ 1623 var this_hash = typeof jQuery(this).parent().attr('id') != 'undefined' && jQuery(this).parent().attr('id') ? jQuery(this).parent().attr('id') : false; 1624 if(!this_hash) return; 1625 1626 setTimeout(function(){ 1627 if(history.pushState) { 1628 history.pushState(null, null, '#'+this_hash); 1629 }else { 1630 location.hash = this_hash; 1631 } 1632 },480); 1633 } 1634 1635 }); 1636 }); 1637} 1638 1639 1640 1641 1642 1643function rockthemes_activate_down_arrows(){ 1644 1645 //Check if header motion element is activated 1646 if(jQuery('.rockthemes-before-header.intro-effect-slide').length){ 1647 1648 jQuery(document).on('rockthemes:intro_effect_canvas_resize', function(){ 1649 jQuery('.rockthemes-before-header.intro-effect-slide').css('height', ''); 1650 if(jQuery('.rockthemes-before-header.intro-effect-slide').children().length){ 1651 //OSX Safari Fix 1652 jQuery('.rockthemes-before-header.intro-effect-slide').css('height', jQuery('.rockthemes-before-header.intro-effect-slide').children().outerHeight()+'px'); 1653 }else{ 1654 jQuery('.rockthemes-before-header.intro-effect-slide').css('height', jQuery('.rockthemes-before-header.intro-effect-slide').outerHeight()+'px'); 1655 } 1656 }); 1657 jQuery('.rockthemes-before-header.intro-effect-slide').appear(); 1658 jQuery('div[data-rsb-fullscreen="true"], section[data-rsb-fullscreen="true"]').each(function(){ 1659 if(jQuery(this).find('.rockthemes-curvy-slider').length < 1){ 1660 jQuery(this).addClass('header'); 1661 } 1662 }); 1663 jQuery('.rockthemes-curvy-slider').addClass('header'); 1664 1665 jQuery(document).trigger('rockthemes:intro_effect_canvas_resize'); 1666 1667 var timeOut = null; 1668 1669 jQuery(document).on('appear', '.rockthemes-before-header.intro-effect-slide', function(e,that){ 1670 1671 if(that.hasClass('modify') && !that.hasClass('modify-motion') && parseInt(that.offset().top + that.outerHeight()) - 40 > jQuery(window).scrollTop()){ 1672 1673 jQuery(document).trigger('rockthemes:scroll_events_disable'); 1674 rockthemes_overlay_transparent_enable(); 1675 1676 that.addClass('modify-motion').removeClass('modify'); 1677 1678 jQuery('html,body').stop(true,true).delay(400).animate({scrollTop:parseInt((that.offset().top))},1100, function(){ 1679 that.removeClass('modify-motion'); 1680 rockthemes_overlay_transparent_disable(); 1681 jQuery(document).trigger('rockthemes:sticky_menu_resize'); 1682 jQuery(document).trigger('rockthemes:scroll_events_enable'); 1683 }); 1684 } 1685 1686 }); 1687 jQuery(document).on('disappear', '.rockthemes-before-header.intro-effect-slide', function(e,that){ 1688 if(that.hasClass('modify-motion') && !that.is(':appeared')){ 1689 that.removeClass('modify-motion'); 1690 jQuery(document).trigger('rockthemes:sticky_menu_resize'); 1691 } 1692 }); 1693 1694 } 1695 1696 1697 //Inline navigation down arrow linking. This linking will use smooth scrolling as well. 1698 jQuery(document).on('click touchend', '.azoom-down-arrow-container', function(e){
1699 1700 var that = jQuery(this).parents('.rockthemes-unique-grid'); 1701 1702 if(that.parents('.rockthemes-before-header').length){ 1703 jQuery(document).trigger('rockthemes:scroll_events_disable'); 1704 rockthemes_overlay_transparent_enable(); 1705 } 1706 1707 var next_el = null; 1708 var found = false; 1709 1710 next_el = that.nextAll('.rockthemes-unique-grid'); 1711 jQuery('.rockthemes-unique-grid').each(function(i){ 1712 if(found){ 1713 next_el = jQuery(this); 1714 found = false; 1715 } 1716 1717 if(typeof jQuery(this).attr('id') !== 'undefined' && jQuery(this).attr('id') == that.attr('id')){ 1718 found = true; 1719 } 1720 }); 1721 1722 1723 1724 var use_intro_effect = false; 1725 //If effect used in before header area, we will go to the menu as next element 1726 if(that.parents('.rockthemes-before-header').length){ 1727 if(jQuery('.header-top-2').length){ 1728 next_el = jQuery('.header-top-2'); 1729 }else{ 1730 if(jQuery('.sticky-header-wrapper').length){ 1731 next_el = jQuery('.sticky-header-wrapper'); 1732 }else{ 1733 if(jQuery('.main-header-area').length){ 1734 next_el = jQuery('.main-header-area'); 1735 } 1736 } 1737 } 1738 1739 if(that.parents('.rockthemes-before-header').hasClass('intro-effect-slide')){ 1740 var header_that = that.parents('.rockthemes-before-header'); 1741 1742 if(!header_that.hasClass('modify-motion') && !header_that.hasClass('modify')){ 1743 header_that.addClass('modify modify-motion'); 1744 1745 use_intro_effect = true; 1746 if(timeOut)clearTimeout(timeOut); 1747 timeOut = setTimeout(function(){ 1748 if(header_that.hasClass('modify-motion')){ 1749 header_that.removeClass('modify-motion'); 1750 } 1751 jQuery(document).trigger('rockthemes:sticky_menu_resize'); 1752 1753 },1400); 1754 } 1755 } 1756 } 1757 1758 setTimeout(function(){ 1759 if(that.parents('.rockthemes-before-header').length){ 1760 1761 jQuery(document).trigger('rockthemes:scroll_events_enable'); 1762 rockthemes_overlay_transparent_disable(); 1763 } 1764 },1500); 1765 1766 if(typeof next_el == 'undefined' || !next_el || typeof next_el.offset() == 'undefined' || !next_el.offset()) return; 1767 1768 var wp_nav_height = 0; 1769 if(rockthemes.frontend_options.is_admin_bar_showing){ 1770 wp_nav_height = jQuery('#wpadminbar').outerHeight(); 1771 } 1772 1773 var scrollTopVal = (parseInt(next_el.offset().top) - parseInt(wp_nav_height)); 1774 if(jQuery('.main-header-area').length && jQuery('.main-header-area').offset().top < scrollTopVal && scrollTopVal - rockthemes.menu.sticky_height > 0){ 1775 scrollTopVal = scrollTopVal - parseInt(rockthemes.menu.sticky_height); 1776 } 1777 jQuery('html, body').animate({'scrollTop':scrollTopVal},1000, function(){ 1778 var this_hash = typeof next_el.attr('id') != 'undefined' && next_el.attr('id') ? next_el.attr('id') : false; 1779 if(!this_hash) return; 1780 1781 setTimeout(function(){ 1782 if(history.pushState) { 1783 history.pushState(null, null, '#'+this_hash); 1784 } 1785 else { 1786 location.hash = this_hash; 1787 } 1788 },100); 1789 }); 1790 }); 1791 1792} 1793 1794/* 1795** Transparent Overlay 1796*/ 1797function rockthemes_overlay_transparent_enable(){ 1798 if(jQuery('#azoom_overlay_transparent').length) return; 1799 1800 jQuery('body').append(jQuery('<div id="azoom_overlay_transparent" class="azoom-fixed-overlay-transparent"></div>')); 1801} 1802function rockthemes_overlay_transparent_disable(){ 1803 if(jQuery('#azoom_overlay_transparent').length){ 1804 jQuery('#azoom_overlay_transparent').remove(); 1805 } 1806} 1807 1808 1809 1810function rockthemes_activate_lightbox(){ 1811 jQuery(document).on('rockthemes:activate_lightbox', function(){ 1812 jQuery('a[data-rel^="prettyPhoto"]').prettyPhoto({ 1813 hook:'data-rel', 1814 overlay_gallery_max:9999 1815 }); 1816 }); 1817 1818 jQuery(document).trigger('rockthemes:activate_lightbox'); 1819} 1820 1821 1822 1823function rockthemes_activate_cat_filter_ajax(){ 1824 if(jQuery('.ajax-category-navigation').length < 1) return; 1825 1826 //TO DO : Bind this to an option 1827 var animate_active = true; 1828 var anim_obj = {_out:'fadeOut',_in:'fadeIn'}; 1829 1830 jQuery('.ajax-category-navigation > ul > li').click(function(){ 1831 var that = jQuery(this).parents('.ajax-category-navigation'); 1832 var _this = jQuery(this); // We need to refer to this to get the category/taxonomy slug and post type 1833 1834 if(that.hasClass('loading')) return; 1835 that.addClass('loading'); 1836 that.find('li a.active').removeClass('active'); 1837 jQuery(this).find(' > a').addClass('active'); 1838 1839 //Data element 1840 var de = jQuery(this).parents('.ajax-category-navigation').find(".data-cat-details"); 1841 //Data send 1842 var ds = de.data(); 1843 1844 //Last Load 1845 de.attr('data-last_load', '0'); 1846 //Update the last_load in data 1847 ds.last_load = 0; 1848 ds.category = _this.attr('data-slug-holder'); 1849 //Masonry initializes an object which is not we are looking for in the data. so just get the true or false. 1850 ds.masonry = (ds.masonry || ds.masonry == 'true') ? 'true' : 'false'; 1851 1852 //List and grid support 1853 var elem_selector = jQuery('#'+ds.id_ref).parents('.azoom-portfolio-container').hasClass('list') ? 'div' : 'li'; 1854 1855 jQuery.post(rockthemes.ajaxurl, {data:ds, _ajax_nonce:rockthemes.nonces.portfolio, action:'rockthemes_portfolio_load_more'}, function(data){ 1856 1857 if(!data || !data.body){ 1858 that.removeClass('loading'); 1859 return; 1860 } 1861 1862 var new_elems = jQuery(data.body); 1863 1864 var holder = jQuery('#'+ds.id_ref); 1865 1866 holder.find(' > '+elem_selector).remove(); 1867 1868 if(animate_active){ 1869 //Hide new elems 1870 new_elems.addClass('azoom-animate-queue'); 1871 } 1872 1873 holder.append(new_elems); 1874 1875 if(typeof ds.masonry != 'undefined' && holder.masonry && (ds.masonry || ds.masonry == 'true')){ 1876 var mo; 1877 holder.masonry('appended', new_elems); 1878 rockthemes_init_single_masonry(holder,mo,true,true); 1879 }else if(animate_active){ 1880 rockthemes_animate_queue(holder,'fadeIn'); 1881 } 1882 1883 //If load more button is active, then update the load more button after filtering 1884 if(that.parents('.azoom-portfolio-container').find('.load-more').length){ 1885 var lmb = that.parents('.azoom-portfolio-container').find('.load-more');//lmb = Load More Button
1886 var lmd = lmb.parent().find('.data-details');//lmd = Load More Data 1887 1888 lmd.attr('data-last_load', '0'); 1889 lmd.attr('data-category',ds.category); 1890 1891 if(!data.disable || data.disable !== 'yes'){ 1892 if(lmb.hasClass('hide')) lmb.removeClass('hide'); 1893 }else if(data.disable && data.disable === 'yes'){ 1894 lmb.addClass('hide'); 1895 } 1896 } 1897 1898 jQuery(document).trigger('rockthemes:activate_lightbox'); 1899 that.removeClass('loading'); 1900 return; 1901 }); 1902 1903 }); 1904} 1905 1906 1907 1908 1909function rockthemes_activate_load_more(){ 1910 if(jQuery('.load-more').length < 1) return; 1911 1912 //TO DO : Bind this to an option 1913 var animate_active = true; 1914 var anim_obj = {_out:'fadeOut',_in:'fadeIn'}; 1915 1916 jQuery('.load-more').click(function(){ 1917 var that = jQuery(this); 1918 1919 if(that.hasClass('loading')) return; 1920 that.addClass('loading'); 1921 1922 //Data element 1923 var de = jQuery(this).parent().find('.data-details'); 1924 //Data send 1925 var ds = de.data(); 1926 1927 1928 //Last Load 1929 var ll = parseInt(parseInt(de.attr('data-last_load')) + parseInt(ds.load_amount)); 1930 de.attr('data-last_load', ll); 1931 //Update the last_load in data 1932 ds.last_load = ll; 1933 ds.category = de.attr('data-category'); 1934 //Masonry initializes an object which is not we are looking for in the data. so just get the true or false. 1935 ds.masonry = (ds.masonry || ds.masonry == 'true') ? 'true' : 'false'; 1936 1937 1938 if(ds.archive_load_more === 'true' || ds.archive_load_more === true){ 1939 1940 1941 var alme = that.parent().find('.archive_load_more').find('.load-more-link').first();//alme = ajax load more elements 1942 var alme_link = alme.attr('href');//alme_link = ajax load more elements link 1943 alme.remove(); 1944 1945 var data = Object(); 1946 if(!that.parent().find('.archive_load_more').find('.load-more-link').length){ 1947 data.disable = 'yes'; 1948 } 1949 var alme_id = '#'+that.attr('data-id_ref'); 1950 1951 1952 1953 jQuery('<div>').load(alme_link+' '+alme_id, function() { 1954 rockthemes_portfolio_ajax_callback_add(that,ds, data, jQuery(jQuery(this).find(alme_id))); 1955 }); 1956 return; 1957 } 1958 1959 //Old Load More system which uses exact details of the query. Still in use for RPB default usage. 1960 jQuery.post(rockthemes.ajaxurl, {data:ds, _ajax_nonce:rockthemes.nonces.portfolio, action:'rockthemes_portfolio_load_more'}, function(data){ 1961 1962 if(!data || !data.body){ 1963 that.removeClass('loading'); 1964 return; 1965 } 1966 1967 1968 var new_elems = jQuery(data.body); 1969 rockthemes_portfolio_ajax_callback_add(that,ds,data,new_elems); 1970 }); 1971 1972 }); 1973} 1974 1975function rockthemes_portfolio_ajax_callback_add(that,ds,data,new_elems){ 1976 1977 var holder = jQuery('#'+that.attr('data-id_ref')); 1978 var animate_active = true; 1979 1980 if(typeof ds.masonry != 'undefined' && (ds.masonry || ds.masonry == 'true')){ 1981 holder.append(new_elems); 1982 1983 holder.imagesLoaded(function(){ 1984 1985 holder.css({'width':''}); 1986 holder.parent().css({'width':''}); 1987 1988 var col_size = rockthemes_masonry_get_col_size(holder); 1989 1990 new_elems.filter('.azoom-default-item:not(.widetall):not(.wide)').css('width', (col_size.px)+'px'); 1991 new_elems.filter('.widetall, .wide').css('width', (col_size.px * 2)+'px'); 1992 if(jQuery(window).width() <= parseInt(col_size.px * 2) - 30){ 1993 new_elems.filter('.widetall, .wide').css('width', ''); 1994 new_elems.filter('.azoom-default-item:not(.widetall):not(.wide)').css('width', ''); 1995 } 1996 1997 if(holder.masonry){ 1998 holder.masonry('appended', new_elems); 1999 } 2000 2001 rockthemes_animate_queue(holder,'fadeIn'); 2002 2003 jQuery(document).trigger('rockthemes:activate_lightbox'); 2004 that.removeClass('loading'); 2005 2006 if(data.disable && data.disable === 'yes'){ 2007 that.addClass('hide'); 2008 } 2009 }); 2010 2011 return; 2012 }else if(animate_active){ 2013 2014 if(new_elems.find('img').length){ 2015 new_elems.imagesLoaded(function(){ 2016 holder.append(new_elems); 2017 rockthemes_animate_queue(holder,'fadeIn'); 2018 2019 jQuery(document).trigger('rockthemes:activate_lightbox'); 2020 that.removeClass('loading'); 2021 2022 if(data.disable && data.disable === 'yes'){ 2023 that.addClass('hide'); 2024 } 2025 return; 2026 }); 2027 }else{ 2028 holder.append(new_elems); 2029 rockthemes_animate_queue(holder,'fadeIn'); 2030 2031 jQuery(document).trigger('rockthemes:activate_lightbox'); 2032 that.removeClass('loading'); 2033 2034 if(data.disable && data.disable === 'yes'){ 2035 that.addClass('hide'); 2036 } 2037 return; 2038 } 2039 } 2040} 2041 2042 2043function rockthemes_activate_portfolio(){ 2044 2045 //No Masonry No Swiper 2046 jQuery('.azoom-portfolio-container').each(function(){ 2047 var that = jQuery(this); 2048 if(!that.hasClass('masonry-active') && !that.find('.swiper-container').length){ 2049 that.imagesLoaded(function(){ 2050 rockthemes_animate_queue(that); 2051 }); 2052 } 2053 }); 2054 2055 2056 //Single Swiper Element 2057 if(jQuery('.swiper-single-element').length){ 2058 jQuery('.swiper-single-element').each(function(){ 2059 if(!jQuery(this).parents('.masonry-active').length && !jQuery(this).parents('.azoom-portfolio').length){ 2060 var jt = jQuery(this); 2061 var side_arrows = jQuery(this).find('.side-arrow-left').length ? true : false; 2062 rockthemes_activate_swiper(jQuery(this), side_arrows); 2063 2064 jQuery(window).smartresize(function(){ 2065 2066 rockthemes_activate_swiper(jt, side_arrows); 2067 }); 2068 } 2069 }); 2070 }; 2071 2072 2073 if(jQuery('.swiper-navigation-active').length){ 2074 jQuery('.swiper-navigation-active').each(function(){ 2075 var that = jQuery(this); 2076 2077 if(!that.find('.rockthemes-masonry').length){ 2078 rockthemes_activate_swiper(that); 2079 jQuery(window).smartresize(function(){ 2080 rockthemes_activate_swiper(that); 2081 }); 2082 } 2083 }); 2084 2085 jQuery(document).on('rockthemes:masonry_single_active', function(e,mas){ 2086 var all_ready = true; 2087 jQuery('#'+mas).find('.azoom-default-item').each(function(){ 2088 if(!jQuery(this).hasClass('masonry-brick')){ 2089 all_ready = false; 2090 } 2091 }); 2092 2093 if(all_ready){ 2094 2095 rockthemes_activate_swiper(jQuery('#'+mas)); 2096 } 2097 }); 2098 } 2099 2100 if(jQuery('.rockthemes-masonry').length < 1){ 2101 return; 2102 } 2103 2104 2105 jQuery('.rockthemes-masonry').each(function(){ 2106 var that = jQuery(this); 2107 2108 var selector = that.attr('data-masonry-elem'); 2109 2110 if(typeof selector == 'undefined') return; 2111 2112 //Masonry Object 2113 var mo; 2114 2115 rockthemes_init_single_masonry(that,mo,true,true); 2116 2117 2118 }); 2119 2120 jQuery(window).smartresize(function(){ 2121 jQuery('.rockthemes-masonry').each(function(){ 2122 var that = jQuery(this); 2123 2124 var selector = that.attr('data-masonry-elem'); 2125 2126 if(typeof selector == 'undefined') return; 2127 2128 //Masonry Object 2129 var mo; 2130 rockthemes_init_single_masonry(that,mo); 2131 2132 }); 2133 }); 2134 2135 2136 2137} 2138 2139function rockthemes_activate_swiper(that, side_arrows){ 2140 2141 var this_id = ''; 2142 if(typeof that.attr('id') !== 'undefined'){ 2143 this_id = '#'+that.attr('id')+' '; 2144 }else if(typeof that.parent().attr('id') !== 'undefined'){ 2145 this_id = '#'+that.parent().attr('id')+' '; 2146 } 2147 2148 //!that.hasClass('wall-mode-active') && was included in if 2149 if(that.hasClass('azoom-portfolio-container') ){ 2150 if(!that.hasClass('wall-mode-active')){ 2151 //Add margins between slides 2152 that.css('width', (parseInt(that.width()) + 20)+'px'); 2153 }else{ 2154 //Make them static int values 2155 that.css('width', (parseInt(that.width()))+'px'); 2156 } 2157 } 2158 2159 if(that.hasClass('swiper-ready')){ 2160 2161 if(that.hasClass('swiper-single-element') || !that.find('.rockthemes-masonry').length){ 2162 2163 that.find('.swiper-container').find('.swiper-slide').css({'height':'', 'width':''}); 2164 that.find('.swiper-wrapper').css({'height':'', 'width':'100%'});
2165 } 2166 that.find('.swiper-container').data('swiper').resizeFix(true); 2167 2168 2169 if(that.parents('.rockthemes-unique-grid').length){ 2170 2171 //If there is a fullscreen grid, resize it 2172 if(that.parents('.rockthemes-unique-grid[data-rsb-fullscreen="true"]').length){ 2173 jQuery(document).trigger('rockthemes:resize_rsb_fullscreen_grid', [that.parents('.rockthemes-unique-grid[data-rsb-fullscreen="true"]')]); 2174 }else if(that.parents('.rockthemes-video-bg').length){ 2175 rockthemes_fullscreen_bg_video(that.parents('.rockthemes-video-bg')); 2176 }else if(that.parents('.rockthemes-parallax').length){ 2177 rockthemes_parallax_bg_image(that.parents('.rockthemes-parallax')); 2178 }else if(that.parents('.rockthemes-static-bg-image').length){ 2179 rockthemes_static_bg_image(that.parents('.rockthemes-static-bg-image')); 2180 } 2181 } 2182 2183 2184 2185 return; 2186 } 2187 2188 2189 2190 var swiper; 2191 if(!that.hasClass('swiper-ready')){ 2192 2193 var swiper_details_obj = { 2194 mode:'horizontal', 2195 calculateHeight:true, 2196 roundLengths:true, 2197 grabCursor:false, 2198 autoResize:false, 2199 resizeReInit:false, 2200 moveStartThreshold:1, 2201 touchRatio: 1, 2202 longSwipesRatio:0.3, 2203 speed:1300, 2204 loop: false, 2205 pagination: (typeof side_arrows !== 'undefined' && side_arrows == true) ? '' : this_id+'.swiper-pagination', 2206 centeredSlides:true, 2207 keyboardControl:true, 2208 onFirstInit:function(){ 2209 2210 if(that.find('.azoom-animate-queue').length){ 2211 rockthemes_animate_queue(that); 2212 } 2213 that.addClass('swiper-ready'); 2214 2215 if(that.parents('.rockthemes-unique-grid').length){ 2216 setTimeout(function(){ 2217 //If there is a fullscreen grid, resize it 2218 if(that.parents('.rockthemes-unique-grid[data-rsb-fullscreen="true"]').length){ 2219 jQuery(document).trigger('rockthemes:resize_rsb_fullscreen_grid', [that.parents('.rockthemes-unique-grid[data-rsb-fullscreen="true"]')]); 2220 }else if(that.parents('.rockthemes-video-bg').length){ 2221 rockthemes_fullscreen_bg_video(that.parents('.rockthemes-video-bg')); 2222 }else if(that.parents('.rockthemes-parallax').length){ 2223 2224 rockthemes_parallax_bg_image(that.parents('.rockthemes-parallax')); 2225 }else if(that.parents('.rockthemes-static-bg-image').length){ 2226 rockthemes_static_bg_image(that.parents('.rockthemes-static-bg-image')); 2227 } 2228 },50); 2229 } 2230 2231 } 2232 } 2233 2234 //Do not enable autoplay for mobile devices 2235 if(!Modernizr.ismobile){ 2236 if(typeof that.attr('data-auto-play') !== 'undefined' && that.attr('data-auto-play') === 'true'){ 2237 var auto_play_time = typeof that.attr('data-auto-play-time') !== 'undefined' && that.attr('data-auto-play-time') ? that.attr('data-auto-play-time') : 5000; 2238 swiper_details_obj.autoplay = parseInt(auto_play_time); 2239 swiper_details_obj.speed = 1300; 2240 //To activate Swiper after user intraction, uncomment this code 2241 //swiper_details_obj.autoplayDisableOnInteraction = false; 2242 } 2243 } 2244 2245 if(typeof that.attr('data-use-pagination') !== 'undefined' && that.attr('data-use-pagination') === 'true'){ 2246 swiper_details_obj.pagination = this_id+' .swiper-pagination'; 2247 } 2248 2249 swiper = that.find('.swiper-container').swiper(swiper_details_obj); 2250 2251 2252 if(typeof side_arrows !== 'undefined' && side_arrows == true){ 2253 if(typeof that.attr('data-use-pagination') !== 'undefined' && that.attr('data-use-pagination') === 'true'){ 2254 2255 }else{ 2256 that.find('.swiper-pagination').remove(); 2257 } 2258 } 2259 2260 2261 that.on('click touchend', '.swiper-pagination .swiper-pagination-switch' , function(){ 2262 swiper.swipeTo(jQuery(this).index()); 2263 }); 2264 2265 if(that.hasClass('azoom-portfolio-container') || that.parents('.azoom-portfolio-container').length){ 2266 var main = that.hasClass('azoom-portfolio-container') ? that : that.parents('.azoom-portfolio-container'); 2267 main.on('click touchend', '.swiper-arrow-left', function(){ 2268 swiper.swipePrev(); 2269 }); 2270 main.on('click touchend', '.swiper-arrow-right', function(){ 2271 swiper.swipeNext(); 2272 }); 2273 } 2274 2275 if(typeof side_arrows !== 'undefined' && side_arrows == true){ 2276 that.find('.side-arrow-left').click(function(e){
2277 e.preventDefault() 2278 swiper.swipePrev(); 2279 }); 2280 that.find('.side-arrow-right').click(function(e){ 2281 e.preventDefault() 2282 swiper.swipeNext(); 2283 }); 2284 } 2285 2286 2287 jQuery(document).trigger('rockthemes:activate_lightbox'); 2288 2289 2290 } 2291 2292} 2293 2294 2295function rockthemes_init_single_masonry(that, mo, load_images, animate){ 2296 animate = (typeof animate == 'undefined' || !animate) ? false : true; 2297 2298 2299 that.css({'height':''}); 2300 2301 2302 that.parent().css({'width':'auto', 'position':'relative', 'display':'block'}); 2303 2304 if(that.parents('.swiper-slide').length){ 2305 that.find('.azoom-animate-queue').removeClass('azoom-animate-queue'); 2306 that.parent().css('width','100%'); 2307 } 2308 2309 var upto_class = ['.azoom-portfolio-container', '.swiper-slide', '.swiper-wrapper', '.azoom-portfolio-container']; 2310 for (var u = 0; u < upto_class.length; u++){ 2311 if(that.parents(upto_class[u]).length){ 2312 that.parents(upto_class[u]).css({'width':'100%'}); 2313 } 2314 } 2315 2316 2317 2318 var col_size = rockthemes_masonry_get_col_size(that); 2319 2320 that.parent().css('width',col_size.cd); 2321 2322 that.find('.azoom-default-item:not(.widetall):not(.wide)').css('width', (col_size.px)+'px'); 2323 that.find('.widetall, .wide').css('width', (col_size.px * 2)+'px'); 2324 if(jQuery(window).width() <= parseInt(col_size.px * 2) - 30){ 2325 that.find('.widetall, .wide').css('width', ''); 2326 that.find('.azoom-default-item:not(.widetall):not(.wide)').css('width', ''); 2327 } 2328 2329 var selector = that.attr('data-masonry-elem'); 2330 2331 2332 if(that.find('.masonry-brick').length){ 2333 2334 //return; 2335 } 2336 2337 //TO DO : Bind anim to data attribute to "that" element 2338 var anim = false; 2339 //Masonry Object 2340 if(typeof load_images != 'undefined' && load_images){ 2341 that.imagesLoaded(function(){ 2342 2343 mo = that.masonry({ 2344 itemSelector:'.'+selector, 2345 transitionDuration: false, 2346 columnWidth:(col_size.px) 2347 }); 2348 2349 jQuery(document).trigger('rockthemes:masonry_single_active', [that.parents('.azoom-portfolio-container').attr('id')]); 2350 2351 if(animate){ 2352 rockthemes_animate_queue(that,anim); 2353 } 2354 2355 }); 2356 }else{ 2357 mo = that.masonry({ 2358 itemSelector:'.'+selector, 2359 transitionDuration: false, 2360 columnWidth:(col_size.px) 2361 }); 2362 2363 2364 jQuery(document).trigger('rockthemes:masonry_single_active', [that.parents('.azoom-portfolio-container').attr('id')]); 2365 2366 if(animate){ 2367 rockthemes_animate_queue(that,anim); 2368 } 2369 2370 2371 } 2372 2373} 2374 2375function rockthemes_animate_queue(that, animation){ 2376 if(typeof that == 'undefined') return; 2377 if(typeof animation == 'undefined' || !animation || animation == '') animation = 'fadeIn'; 2378 2379 that.find('.azoom-default-item.azoom-animate-queue').each(function(i){ 2380 2381 var ref_elem = jQuery(this); 2382 if(jQuery(this).parents('.swiper-slide').length){ 2383 2384 jQuery(this).addClass('animated '+animation).removeClass('azoom-animate-queue'); 2385 }else{ 2386 setTimeout(function(){ 2387 ref_elem.addClass('animated '+animation).removeClass('azoom-animate-queue'); 2388 }, parseInt(180 * i)); 2389 } 2390 }); 2391} 2392 2393 2394function rockthemes_masonry_get_col_size(that){ 2395 if(typeof that == 'undefined') return 540; 2396 2397 2398 2399 var tc = 4;//Total Columns 2400 var ec = that.attr('class').split(' '); 2401 2402 2403 //Clear class names if there are multiple spaces 2404 for(var i=0; i<ec.length; i++){ 2405 if(ec[i] == ''){ 2406 ec.splice(i,1); 2407 } 2408 } 2409 2410 tc = rockthemes_check_class_names(ec,that); 2411 2412 2413 2414 return {px:((that.outerWidth()) / tc), fluid:( 100 / tc), cols:tc, cd:(that.outerWidth())}; 2415} 2416 2417function rockthemes_check_class_names(ar,that){ 2418 //Return 4 if nothing is there 2419 if(typeof ar == 'undefined') return 4; 2420 2421 var w = jQuery(window); 2422 var class_name = ''; 2423 2424 if(w.width() > parseInt(rockthemes.grid.block.medium)){ 2425 class_name = 'large-block-grid-'; 2426 }else if(w.width() >= parseInt(rockthemes.grid.block.small)){ 2427 class_name = 'medium-block-grid-'; 2428 }else{ 2429 class_name = 'small-block-grid-'; 2430 } 2431 2432 var col = 4; 2433 for(var i = 0; i<ar.length; i++){ 2434 if(ar[i].indexOf(class_name) > -1){ 2435 col = parseInt(ar[i].trim().replace(class_name,'')); 2436 } 2437 } 2438 2439 return col; 2440} 2441 2442 2443 2444function rockthemes_activate_hover(){ 2445 //Add every element like portfolio li to this array 2446 var hover_elems = ['.azoom-default-item .rockthemes-hover', '.single-box-element', '.entry-thumbn
2446ail', '.rockthemes-wp-gallery li']; 2447 var hover_classes = 'hover-active-medium hover-active hover-active-small'; 2448 2449 for(var i = 0; i<hover_elems.length; i++){ 2450 var that = hover_elems[i]; 2451 //Check if it's small for hover effect 2452 jQuery(document).on('mouseenter', that, function(){ 2453 rockthemes_hover_vertical_center(jQuery(this)); 2454 jQuery(this).addClass(rockthemes_get_hover_active_class(jQuery(this))); 2455 }). 2456 on('touchstart', that, function(e){ 2457 jQuery(this).attr('data-touch-start-y', e.originalEvent.touches[0].pageY); 2458 }). 2459 on('touchend', that, function(e){ 2460 //e.preventDefault(); 2461 var tend = e.originalEvent.changedTouches[0].pageY; 2462 if(typeof jQuery(this).attr('data-touch-start-y') !== 'undefined' && 2463 Math.abs(parseInt(jQuery(this).attr('data-touch-start-y')) - tend) < 5){ 2464 jQuery(this).addClass(rockthemes_get_hover_active_class(jQuery(this))); 2465 jQuery(this).attr('data-touch-start-y', tend); 2466 } 2467 }). 2468 on('mouseleave', that, function(){ 2469 jQuery(this).removeClass(rockthemes_get_hover_active_class(jQuery(this))); 2470 }). 2471 on('click', '.hover-mobile-back', function(){ 2472 2473 }). 2474 on('touchend', that+' .hover-mobile-back', {that:that}, function(e){ 2475 e.originalEvent.preventDefault(); 2476 e.stopPropagation(); 2477 2478 var el = jQuery(this).parents(e.data.that); 2479 el.removeClass(rockthemes_get_hover_active_class(el)); 2480 el.attr('data-touch-start-y', e.originalEvent.changedTouches[0].pageY); 2481 }). 2482 on('touchend', '.small-hover-elem', {that:that}, function(e){ 2483 e.preventDefault(); 2484 e.stopPropagation(); 2485 if(typeof jQuery(this).attr('data-link_url') != 'undefined'){ 2486 window.location = jQuery(this).attr('data-link_url'); 2487 } 2488 var el = jQuery(this).parents(that); 2489 el.removeClass(rockthemes_get_hover_active_class(el)); 2490 el.attr('data-touch-start-y', e.originalEvent.changedTouches[0].pageY); 2491 }); 2492 } 2493 2494 jQuery(document).on('touchend', '.single-image-hover-centered', function(e){ 2495 var el = jQuery(this); 2496 if(el.hasClass('hover-active')){ 2497 el.removeClass('hover-active'); 2498 }else{ 2499 el.addClass('hover-active'); 2500 e.preventDefault(); 2501 e.stopImmediatePropagation(); 2502 } 2503 }); 2504} 2505 2506//function rockthemes_hover_vertical_center(hover_elems){ 2507function rockthemes_hover_vertical_center(res){ 2508 res.css('padding-top',''); 2509 var hi = res.find('.hover-item-details-container'), 2510 th = 0; 2511 2512 hi.children().each(function(){ 2513 th = th + parseInt(jQuery(this).outerHeight(true)); 2514 }); 2515 2516 2517 th = parseInt((hi.outerHeight() - th) / 2) - 19; 2518 if(th < 19) th = 19; 2519 2520 hi.css('padding-top',th+'px'); 2521} 2522 2523function rockthemes_get_hover_active_class(that){ 2524 2525 //For list mode and different elements, only use the hover element's size 2526 if(that.find('.rockthemes-hover').length){ 2527 that = that.find('.rockthemes-hover'); 2528 } 2529 2530 var large_width = parseInt(rockthemes.hover_details.hover_width_min_large); 2531 var large_height = parseInt(rockthemes.hover_details.hover_height_min_large); 2532 2533 var medium_width = parseInt(rockthemes.hover_details.hover_width_min_medium); 2534 var medium_height = parseInt(rockthemes.hover_details.hover_height_min_medium); 2535 2536 if(that.find('.woo-grid-hover').length){ 2537 large_height += 75; 2538 } 2539 2540 if(that.parents('.dunder_image').length){ 2541 medium_height = 140; 2542 } 2543 2544 var class_name; 2545 2546 if((that.width() * that.height()) >= (large_width * large_height) && that.height() > large_height){ 2547 //Large display 2548 class_name = 'hover-active'; 2549 }else if((that.width() * that.height()) >= (medium_width * medium_height) && that.width() > medium_width && that.height() > medium_height){ 2550 //Medium display 2551 class_name = 'hover-active-medium hover-active'; 2552 }else{ 2553 //Small display 2554 class_name = 'hover-active-small'; 2555 } 2556 2557 return class_name; 2558} 2559 2560 2561 2562 2563/* 2564** Makes the flash responsive. This will also require a CSS rule to make flash width 100%; 2565** 2566** @since : 1.3 2567** @return : void 2568*/ 2569function rockthemes_responsive_flash(){ 2570 //Return if no flash exists. 2571 if(jQuery('object[type="application/x-shockwave-flash"]').length < 1) return; 2572 2573 var flash = [], 2574 rebuild = setTimeout(function(){return;},10); 2575 2576 jQuery('object[type="application/x-shockwave-flash"]').each(function (){ 2577 flash.push({ 2578 element: jQuery(this), 2579 height: jQuery(this).attr('height'), 2580 width: jQuery(this).attr('width') 2581 }); 2582 }); 2583 2584 jQuery(window).smartresize(function() { 2585 clearTimeout(rebuild); 2586 rebuild = setTimeout(resize_flash, 100); 2587 }); 2588 2589 function resize_flash(){ 2590 if(flash.length < 1) return; 2591 2592 jQuery.each(flash, function (i, value) { 2593 flash[i].element.height(flash[i].element.width() / flash[i].width * flash[i].height); 2594 }); 2595 } 2596 2597 resize_flash(); 2598} 2599 2600 2601 2602function rockthemes_check_bg_videos(){ 2603 if(Modernizr.touch){ 2604 jQuery('.rockthemes-video-bg').each(function(){ 2605 var that = jQuery(this); 2606 var img = that.attr('data-video_bg_fallback_url'); 2607 2608 if(typeof img === 'undefined' || img === ''){
2609 if(that.find('.azoom-iframe-container').length){ 2610 that.find('.azoom-iframe-container').remove(); 2611 } 2612 2613 if(that.find('video').length){ 2614 that.find('video').remove(); 2615 } 2616 2617 return; 2618 } 2619 2620 //It's HTML5 Video background 2621 if(!that.find('iframe').length){ 2622 2623 //If this is a fullscreen element, fullscreen will handle the details. So return. 2624 if(typeof that.attr('data-rsb-fullscreen') != 'undefined' && that.attr('data-rsb-fullscreen') == 'true'){ 2625 return; 2626 } 2627 2628 var ve = that.find('video'), 2629 th = that.outerHeight(), 2630 tw = parseInt(ve.width() * th / ve.height()), 2631 ml = -parseInt((tw - jQuery(window).width()) / 2); 2632 2633 that.find('video').css({ 2634 'min-height':th+'px', 2635 'width':tw+'px', 2636 'margin-left':ml+'px' 2637 }); 2638 }else{ 2639 that.find('iframe').before('<img src="'+img+'" alt="Video" />'); 2640 that.find('.azoom-iframe-container').css({ 2641 'padding':'0px', 2642 'height':'auto', 2643 'top':'' 2644 }); 2645 that.find('iframe').remove(); 2646 } 2647 }); 2648 2649 return; 2650 } 2651 2652 //Vimeo Player API 2653 jQuery('.azoom-iframe-container.vimeo-video.use-api > iframe').each(function(){ 2654 var iframe = jQuery(this)[0]; 2655 Froogaloop(iframe).addEvent('ready', rockthemes_vimeo_ready); 2656 }); 2657 function rockthemes_vimeo_ready(player_id){ 2658 if(jQuery('#'+player_id).length && jQuery('#'+player_id).parents('.not-visible').length){ 2659 jQuery('#'+player_id).parents('.not-visible').removeClass('not-visible'); 2660 } 2661 var player = Froogaloop(player_id); 2662 player.api('setVolume',0); 2663 } 2664 2665 2666 //Youtube Player API 2667 if(jQuery('.azoom-iframe-container.youtube-video.use-api .youtube-video-iframe-holder').length){ 2668 //Only works normally when loaded via js 2669 var tag = document.createElement('script'); 2670 var protocol = window.location.protocol == 'https:' ? 'https' : 'http'; 2671 tag.src = protocol+'://www.youtube.com/iframe_api'; 2672 var firstScriptTag = document.getElementsByTagName('script')[0]; 2673 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 2674 } 2675} 2676 2677 2678//This function name is static because of Youtube 2679function onYouTubeIframeAPIReady() { 2680 jQuery('.azoom-iframe-container.youtube-video.use-api .youtube-video-iframe-holder').each(function(){ 2681 var hid = jQuery(this).attr('id');// HTML ID 2682 var yid = jQuery(this).parents('.azoom-iframe-container').attr('data-youtube-id');// Youtube ID 2683 var player = new YT.Player(hid, 2684 { 2685 playerVars: { 'autoplay': 1, 'loop': 1, 'playlist': yid, 'modestbranding': 1, 'controls': 0, 'showinfo' : 0, 'rel': 0, 'wmode':'transparent' }, 2686 videoId:yid, 2687 events: { 2688 'onReady': rockthemes_youtube_onPlayerReady, 2689 } 2690 }); 2691 }); 2692} 2693 2694function rockthemes_youtube_onPlayerReady(event){ 2695 //event.target.mute(); 2696 event.target.mute(); 2697 2698 //If there are fullscreen videos that not sized, this queue will size them 2699 rockthemes_check_queue_videos(); 2700} 2701 2702 2703function rockthemes_get_font_name(font_family){ 2704 font_family = font_family.toString(); 2705 var font_name = ''; 2706 if(font_family.indexOf("'") > -1){ 2707 //Check if using single quote ' 2708 font_name = font_family.match(/\'.*?\'/i); 2709 if(!font_name[0]){ 2710 return ''; 2711 } 2712 font_name = font_name[0].split("'").join(""); 2713 }else if(font_family.indexOf('"') > -1){ 2714 //Check if using double quote " 2715 font_name = font_family.match(/\".*?\"/i); 2716 if(!font_name[0]){ 2717 return ''; 2718 } 2719 font_name = font_name[0].split('"').join(''); 2720 }else{ 2721 return ''; 2722 } 2723 2724 return font_name; 2725} 2726 2727 2728 2729 2730 2731 2732function rockthemes_fullscreen_elements(){ 2733 2734 2735 //Check if there are fullscreen elements in the above header area. If not remove the animation. 2736 if(!jQuery('.rockthemes-before-header.intro-effect-slide div[data-rsb-fullscreen="true"], .rockthemes-before-header.intro-effect-slide section[data-rsb-fullscreen="true"]').length){ 2737 jQuery('.rockthemes-before-header.intro-effect-slide').removeClass('intro-effect-slide'); 2738 } 2739 2740 var clear_classes = ['.rockthemes-before-header.intro-effect-slide', '.rockthemes-unique-grid', '.static-bg-mask-class','.bg-image-overlay']; 2741 for(var s = 0; s<clear_classes.length; s++){ 2742 var del_style = jQuery(clear_classes[s]); 2743 if(del_style.length){ 2744
2745 del_style.css({'min-height':'', 'height':''}); 2746 } 2747 del_style = null; 2748 } 2749 2750 2751 //Special Grid Full Screen Elements 2752 jQuery('div[data-rsb-fullscreen="true"], section[data-rsb-fullscreen="true"]').each(function(){ 2753 //Reference 2754 var that=jQuery(this); 2755 rockthemes_rsb_fullscreen(that); 2756 }); 2757 jQuery(document).on('rockthemes:resize_rsb_fullscreen_grid', function(e, elem){ 2758 rockthemes_rsb_fullscreen(elem); 2759 if(elem.hasClass('.rockthemes-video-bg')){ 2760 rockthemes_fullscreen_bg_video(elem); 2761 } 2762 if(elem.hasClass('.rockthemes-parallax')){ 2763 rockthemes_parallax_bg_image(elem); 2764 } 2765 if(elem.hasClass('.rockthemes-static-bg-image')){ 2766 rockthemes_static_bg_image(elem); 2767 } 2768 }); 2769 2770 2771 //Special Grid Full Screen Video 2772 jQuery('.rockthemes-video-bg[data-rsb-fullscreen="true"]').each(function(){ 2773 //Reference 2774 var that=jQuery(this); 2775 var w=jQuery(window); 2776 2777 //Youtube load async. If this is a youtube video, it might not be changed to iframe from div 2778 if(jQuery(this).find('iframe').length < 1 && jQuery(this).find('video').length < 1){ 2779 rockthemes.init_queue.fullscreen_bg_videos.push(that); 2780 return; 2781 } 2782 2783 rockthemes_fullscreen_bg_video(that); 2784 }); 2785 2786 2787 //Parallax Background Images 2788 jQuery('.rockthemes-unique-grid.rockthemes-parallax').each(function(){ 2789 rockthemes_parallax_bg_image(jQuery(this)); 2790 }); 2791 2792 2793 //Background Images for Unique Grid 2794 jQuery('.rockthemes-unique-grid.rockthemes-static-bg-image').each(function(){ 2795 rockthemes_static_bg_image(jQuery(this)); 2796 }); 2797 2798 2799} 2800//Full screen special grid. This will only resize the grid not the content. 2801function rockthemes_rsb_fullscreen(that){ 2802 var w=jQuery(window), 2803 m=jQuery('#main-container').length ? jQuery('#main-container') : jQuery('body'); 2804 //Clear Style 2805 that.css({'min-height':'','height':''}); 2806 2807 2808 2809 var that_height = that.outerHeight(); 2810 2811 var e_height = (w.height() > that_height) ? w.height() : 'auto';//that_height was auto 2812 2813 2814 //Resize the div. This will avoid weird look on the load 2815 if(jQuery(this).find('.rockthemes-curvy-slider').length && m.width() < 800 && w.height() < 800){ 2816 that.css({'width':'100%', 'height':'auto'}); 2817 }else{ 2818 that.css({'width':m.width(), 'min-height':e_height}); 2819 } 2820} 2821 2822 2823 2824function rockthemes_static_bg_image(that){ 2825 var tile = false; 2826 //Init the required details 2827 if(that.find('.static-bg-mask-class').length < 1){ 2828 if(that.hasClass("rockthemes-fullwidth-colored")) that.removeClass("rockthemes-fullwidth-colored").attr("style",""); 2829 2830 if(that.attr('data-image-tile') && that.attr('data-image-tile') === 'tile'){ 2831 tile = true; 2832 } 2833 2834 var vertical_space = that.attr('data-padding') !== '' ? that.attr('data-padding') : ''; 2835 var overlay_style = that.attr('data-overlay-color') !== '' ? that.attr('data-overlay-color') : ''; 2836 var data_image = window.devicePixelRatio >= 2 && typeof that.attr('data-static-bg-image-retina') !== 'undefined' ? that.attr('data-static-bg-image-retina') : that.attr('data-static-bg-image'); 2837 2838 var mask = '<div class="static-bg-mask-class" style="background:url('+data_image+') '+(!tile ? 'no-repeat; background-size:100% auto;' : '')+'">'+ 2839 '<div class="bg-image-overlay '+vertical_space+'" style="'+overlay_style+'"></div>'+ 2840 '</div>'; 2841 2842 that.wrapInner(mask); 2843 2844 //Clear the bg style. This style just added for Google Crawl Text Mode 2845 that.css({ 2846 'background-image':'', 2847 'background-color':'', 2848 'background-attachment': '', 2849 'background-size': '', 2850 'background-origin': '', 2851 'background-clip': '', 2852 'background-position': '', 2853 'background-repeat': '' 2854 }); 2855 2856 } 2857 2858 if(tile){ 2859 return; 2860 } 2861 2862 //Background sizing 2863 var img = {w:1920, h:1080}; 2864 if(typeof that.attr('data-image-ratio') != 'undefined' && that.attr('data-image-ratio')){ 2865 var img_r = that.attr('data-image-ratio').split('_'); 2866 img.w = img_r[0]; 2867 img.h = img_r[1]; 2868 } 2869 2870 var mask_elem = that.find('.static-bg-mask-class'); 2871 mask_elem.css('height','');//Clear height value to get the exact content height 2872 mask_elem.find('.bg-image-overlay').css({'min-height':''}); 2873 2874 var con = {w:that.width(), h:that.height()}; 2875 var factor = Math.max(con.w / img.w, con.h / img.h); 2876 2877 var mask_height = typeof that.attr("data-static-mask-height") !== 'undefined' && that.attr("data-static-mask-height") !== '' ? parseInt(that.attr("data-static-mask-height")) : 0; 2878 //mask_elem.css('height','');//Clear height value to get the exact content height 2879 mask_height = Math.max(mask_height, that.height()); 2880 2881 2882 mask_elem.find('.bg-image-overlay').css({'min-height':mask_height+'px'}); 2883 mask_elem.css({'background-size':'cover', 'background-position':'0px 50%'});
2884} 2885 2886 2887 2888 2889function rockthemes_parallax_bg_image(that){ 2890 2891 //Parallax Model 2892 var parallax_model = typeof that.attr('data-parallax-model') !== 'undefined' && that.attr('data-parallax-model') !== '' ? that.attr('data-parallax-model') : 'height_specific'; 2893 if(Modernizr.ismobile || jQuery(window).width() > 1920){ 2894 parallax_model = 'height_specific'; 2895 } 2896 2897 //Init the required details 2898 if(that.find('.parallax-mask-class').length < 1){ 2899 if(that.hasClass("rockthemes-fullwidth-colored")) that.removeClass("rockthemes-fullwidth-colored").attr("style",""); 2900 2901 2902 var vertical_space = typeof that.attr('data-parallax-padding') !== 'undefined' && that.attr('data-parallax-padding') !== '' ? that.attr('data-parallax-padding') : ''; 2903 var overlay_style = typeof that.attr('data-overlay-color') !== 'undefined' && that.attr('data-overlay-color') !== '' ? that.attr('data-overlay-color') : ''; 2904 var data_image = window.devicePixelRatio >= 2 && typeof that.attr('data-parallax-bg-image-retina') !== 'undefined' ? that.attr('data-parallax-bg-image-retina') : that.attr('data-parallax-bg-image'); 2905 2906 var mask = '<div class="parallax-mask-class '+parallax_model+'" style="background-image:url('+data_image+') ; ">'+ 2907 '<div class="bg-image-overlay '+vertical_space+'" style="'+overlay_style+'">'+ 2908 '</div>'+ 2909 '</div>'; 2910 2911 that.wrapInner(mask); 2912 2913 //Clear the bg style. This style just added for Google Crawl Text Mode 2914 that.css({ 2915 'background-image':'', 2916 'background-color':'', 2917 'background-attachment': '', 2918 'background-size': '', 2919 'background-origin': '', 2920 'background-clip': '', 2921 'background-position': '', 2922 'background-repeat': '' 2923 }); 2924 2925 rockthemes_add_image_size_data(that.find('.parallax-mask-class')); 2926 2927 if(!Modernizr.ismobile && parallax_model === 'advanced_parallax' && jQuery(window).width() <= 1440) { 2928 that.find(".parallax-mask-class").parallax("50%", 0.4); 2929 } 2930 2931 } 2932 2933 2934 //Background sizing 2935 var img = {w:1920, h:1080}; 2936 if(typeof that.attr('data-image-main-width') !== 'undefined' && 2937 typeof that.attr('data-image-min-height') !== 'undefined'){ 2938 2939 img.w = parseInt(that.attr('data-image-main-width')); 2940 img.h = parseInt(that.attr('data-image-main-height')); 2941 }else if(typeof that.attr('data-image-ratio') != 'undefined' && that.attr('data-image-ratio')){ 2942 var img_r = that.attr('data-image-ratio').split('_'); 2943 img.w = img_r[0]; 2944 img.h = img_r[1]; 2945 } 2946 var con = {w:that.width(), h:jQuery(window).height()}; 2947 var mask_elem = that.find('.parallax-mask-class'); 2948 var factor = Math.max(con.w / img.w, con.h / img.h); 2949 2950 2951 var mask_height = typeof that.attr("data-parallax-mask-height") !== 'undefined' && that.attr("data-parallax-mask-height") !== '' && that.attr("data-parallax-mask-height") ? parseInt(that.attr("data-parallax-mask-height")) : 0; 2952 2953 mask_elem.css('height','');//Clear height value to get the exact content height 2954 mask_elem.find('.bg-image-overlay').css({'min-height':''}); 2955 2956 /* 2957 ** TO DO : 2958 ** This method will be tested on mobile 2959 */ 2960 if(Modernizr.ismobile){ 2961 if(con.h < that.height()){ 2962 factor = (Math.max(con.w / img.w, (that.height()) / img.h)); 2963 } 2964 } 2965 2966 2967 mask_height = Math.max(mask_height, that.height()); 2968 2969 2970 mask_elem.find('.bg-image-overlay').css({'min-height':mask_height+'px'}); 2971 2972 2973 if(parallax_model !== 'advanced_parallax') { 2974 //mask_elem.css({'background-size':parseInt(img.w * factor)+'px '+parseInt(img.h * factor)+'px'}); 2975 } 2976} 2977 2978/* 2979** Data attribute for default image sizes. 2980** http://stackoverflow.com/questions/5106243/how-do-i-get-background-image-size-in-jquery 2981*/ 2982function rockthemes_add_image_size_data(that){ 2983 var image_url = that.css('background-image'), 2984 image; 2985 2986 // Remove url() or in case of Chrome url("") 2987 image_url = image_url.match(/^url\("?(.+?)"?\)$/); 2988 2989 if (typeof image_url != 'undefined' && jQuery.isArray(image_url) && image_url[1]) { 2990 image_url = image_url[1]; 2991 image = new Image(); 2992 2993 // just in case it is not already loaded 2994 jQuery(image).load(function () { 2995 that.attr('data-image-main-width',image.width); 2996 that.attr('data-image-main-height',image.height); 2997 image = null; 2998 }); 2999 3000 image.src = image_url; 3001 } 3002} 3003 3004 3005 3006 3007function rockthemes_check_queue_videos(){ 3008 for(var i = 0; i< rockthemes.init_queue.fullscreen_bg_videos.length; i++){ 3009 rockthemes_fullscreen_bg_video(rockthemes.init_queue.fullscreen_bg_videos[i]); 3010 } 3011} 3012 3013function rockthemes_fullscreen_bg_video(that){ 3014 var w = { 3015 width:function(){ 3016 return jQuery(window).width(); 3017 }, 3018 height:function(){ 3019 return (jQuery(window).height() > that.outerHeight() ? jQuery(window).height() : that.outerHeight()) + 15; 3020 } 3021 } 3022 //v is Video 3023 var v; 3024 var iframe_container = null; 3025 var user_ratio = {w:16, h:9}; 3026 3027 //Check the RPB user video ratio 3028 if(typeof that.attr('data-rsb-ratio') != 'undefined' && that.attr('data-rsb-ratio')){ 3029 var tem = that.attr('data-rsb-ratio').split('_');
3030 user_ratio = {w:parseInt(tem[0]), h:parseInt(tem[1])}; 3031 } 3032 3033 //If HTML5 video, video ratio might be different. Check if it's set up before (resize etc) 3034 if(typeof that.attr('data-html5-video-ratio') != 'undefined' && that.attr('data-html5-video-ratio')){ 3035 var sem = that.attr('data-html5-video-ratio').split('_'); 3036 user_ratio = {w:parseInt(sem[0]), h:parseInt(sem[1])}; 3037 } 3038 3039 3040 3041 if(that.find('video').length){ 3042 v = that.find('video'); 3043 if(typeof that.attr('data-html5-video-ratio') != 'undefined' && that.attr('data-html5-video-ratio')){ 3044 //Do nothing 3045 }else{ 3046 v.on('loadedmetadata', function() { 3047 //It's HTML5 video and ratio might be different than user entry. Get the real ratio and add it as an attribute 3048 user_ratio.w = parseInt(v.width()); 3049 user_ratio.h = parseInt(v.height() - 4);//+4 for border etc 3050 that.attr('data-html5-video-ratio', user_ratio.w+'_'+user_ratio.h); 3051 }); 3052 } 3053 }else{ 3054 v = that.find('iframe'); 3055 iframe_container = that.find('.azoom-iframe-container'); 3056 } 3057 3058 3059 //Video Originial Ratio 3060 var r = user_ratio.w/user_ratio.h; 3061 //Window Ratio 3062 var wr = w.width() / w.height(); 3063 3064 //Resize it 3065 if(wr > r){ 3066 if(iframe_container){ 3067 iframe_container.css({'width':w.width()+'px','height':parseInt(user_ratio.w * w.height() / user_ratio.h )+'px'}); 3068 }else{ 3069 v.css({'width':w.width()+'px','height':parseInt( user_ratio.w / user_ratio.h * w.height())+'px'}); 3070 } 3071 }else{ 3072 if(iframe_container){ 3073 iframe_container.css({'width':parseInt(w.height() * user_ratio.w / user_ratio.h)+'px', 'height':w.height()+'px', 'top':'0px'}); 3074 }else{ 3075 v.css({'width':parseInt(w.height() * user_ratio.w / user_ratio.h)+'px', 'height':w.height()+'px', 'top':'0px'}); 3076 } 3077 } 3078 3079 //Set to the default area 3080 if(iframe_container){ 3081 iframe_container.css({'left':'0px','top':'0px'}); 3082 }else{ 3083 v.css({'left':'0px','top':'0px'}); 3084 } 3085 3086 //Move it 3087 var l_moved = false; 3088 if(v.width() > w.width()){ 3089 l_moved = true; 3090 if(iframe_container){ 3091 iframe_container.css('left', '-'+(parseInt((v.width() - w.width())/2) - 2)+'px'); 3092 }else{ 3093 v.css('left', '-'+parseInt((v.width() - w.width())/2)+'px'); 3094 } 3095 } 3096 if(!l_moved && iframe_container){ 3097 iframe_container.css('left', '-2px'); 3098 } 3099 3100 if(v.height() > w.height()){ 3101 if(iframe_container){ 3102 iframe_container.css('top', '-'+(parseInt((v.height() - (w.height()))/2) )+'px'); 3103 }else{ 3104 v.css('top', '-'+parseInt((v.height() - w.height())/2)+'px'); 3105 } 3106 } 3107 3108 that.css({'width':w.width(), 'height':w.height()}); 3109 3110 if(typeof v.attr('src') != 'undefined' && v.attr('src') && v.attr('src').toString().indexOf('vimeo') > -1){ 3111 if(typeof rockthemes.visibility_hidden_elements == 'undefined' || !rockthemes.visibility_hidden_elements){ 3112 rockthemes.visibility_hidden_elements = new Array(); 3113 rockthemes.visibility_hidden_elements.push(iframe_container); 3114 } 3115 } 3116 3117 that.css({'visibility':'visible'}); 3118} 3119 3120 3121 3122 3123function rockthemes_menu_ajax_woocommerce_cart(){ 3124 //Check if WooCommerce details exist 3125 if(jQuery('.azoom-undermenu-mask').length < 1) return; 3126 3127 var underbox_menu_mask = jQuery('.azoom-undermenu-mask');//Performance increase 3128 var underbox_menu = jQuery('.azoom-undermenu-box'); 3129 var is_box_active = false; 3130 //Display cart after a new item added to the cart 3131 var display_cart_ar = (typeof rockthemes.woocommerce.auto_display_cart_after_refresh != "undefined" && rockthemes.woocommerce.auto_display_cart_after_refresh == true ? true : false); 3132 //var results_holder = jQuery('.ajax-search-results'); 3133 var to_all_button_cover = jQuery('.undermenu-box-button-cover'); 3134 var to_all_button = jQuery('.undermenu-box-button'); 3135 var to_all_button_height = 63 + 10;//+10 is for radius 3136 var cart_link_html = '<div class="link-icon azoom-transition-fast">'+ 3137 '<i class="icomoon icomoon-icon-next15"></i>'+ 3138 '</div>'; 3139 if(rockthemes.is_rtl == 'rtl'){ 3140 cart_link_html = '<div class="link-icon azoom-transition-fast">'+ 3141 '<i class="icomoon icomoon-icon-previous11"></i>'+ 3142 '</div>'; 3143 } 3144 var cart_datas = []; 3145 var woo_initialized = false;//Add some classes to the widget 3146 var remove_classes = ''; 3147 for (var r = 0; r < rockthemes.settings.undermenu_box_classes.length; r++){ 3148 if(rockthemes.settings.undermenu_box_classes[r] != 'woocommerce-cart-active'){ 3149 remove_classes += rockthemes.settings.undermenu_box_classes[r]+' '; 3150 } 3151 } 3152 3153 3154 //Add to cart clicked, find the product 3155 jQuery(document).on('click', '.add_to_cart_button', function(){ 3156 var product = null; 3157 if(jQuery(this).parents('.product:eq(0)').length){ 3158 product = jQuery(this).parents('.product:eq(0)'); 3159 }else if(jQuery(this).parents('.azoom-default-item').length){ 3160 product = jQuery(this).parents('.azoom-default-item'); 3161 } 3162 3163 if(product && product.find('.added_icon').length < 1){ 3164 product.find('.grid-price').append(' <i class="icomoon icomoon-icon-checkmark animated bounceIn added_icon"></i>'); 3165 } 3166 }); 3167 3168 //Get first cart datas 3169 var data_timer = setTimeout(data_timer_function,50); 3170 var data_timer_max_count = 10, 3171 data_timer_current_count = 0; 3172 function data_timer_function(){ 3173 if(jQuery('.azoom-woocommerce-box .cart_list li').length > 0 && typeof jQuery('.azoom-woocommerce-box .cart_list li').html() != "undefined"){ 3174 clearTimeout(data_timer); 3175 3176 if(!woo_initialized){ 3177 //Initialize WooCommerce Cart for styling 3178 init_woo_cart(); 3179 } 3180 3181 get_cart_datas(); 3182 }else{ 3183 clearTimeout(data_timer); 3184 data_timer_current_count++; 3185 if(data_timer_current_count < data_timer_max_count){ 3186 setTimeout(data_timer_function,50); 3187 } 3188 } 3189 } 3190 3191 function get_cart_datas(){ 3192 if(jQuery('.azoom-woocommerce-box .cart_list li .ajax-cart-content a .text-overflow').length < 1){ 3193 cart_datas = []; 3194 return; 3195 } 3196 3197 var cart_item_html = jQuery('.azoom-woocommerce-box .cart_list li'); 3198 cart_datas = []; 3199 cart_item_html.each(function(){ 3200 var el = jQuery(this).find('.ajax-cart-content').length > 0 ? jQuery(this).find('.ajax-cart-content') : jQuery(this) ; 3201 cart_datas.push({name:el.find('a .text-overflow').html(), quantity:el.find('.quantity').html(), link_url:el.find('a').not('.remove').attr('href')}); 3202 }); 3203 } 3204 3205 function return_new_item_in_cart(){ 3206 if(cart_datas.length <= 0) get_cart_datas(); 3207 3208 var el; 3209 var found = false; 3210 var cart_item_html = jQuery('.azoom-woocommerce-box-content .cart_list li'); 3211 if(cart_datas.length > 0 && cart_item_html.find('.ajax-cart-content').length){ 3212 cart_item_html.each(function(){ 3213 if(found) return; 3214 var that = jQuery(this).find('.ajax-cart-content'); 3215 for(var s = 0; s < cart_datas.length; s++){ 3216 if(that.find('a .text-overflow').html().trim() == cart_datas[s].name.trim() && that.find('a').not('.remove').attr('href').trim() == cart_datas[s].link_url.trim() 3217 && that.find('.quantity').html().trim() != cart_datas[s].quantity.trim() ){ 3218 el = that; 3219 3220 found = true; 3221 return; 3222 } 3223 } 3224 }); 3225 } 3226 3227 if(!found){ 3228 el = jQuery('.azoom-woocommerce-cart-wrapper.azoom-woocommerce-box .azoom-woocommerce-box-content ul.cart_list li').last().find('.ajax-cart-content'); 3229 } 3230 3231 //Update datas 3232 get_cart_datas(); 3233 return el; 3234 } 3235 3236 3237 function update_woo_cart_contents(){ 3238 if(!woo_initialized){ 3239 //Initialize WooCommerce Cart for styling 3240 init_woo_cart(); 3241 }else{ 3242 jQuery('.azoom-woocommerce-cart-wrapper.azoom-woocommerce-box .azoom-woocommerce-box-content ul.cart_list').addClass('large-block-grid-3 medium-block-grid-2 small-block-grid-1'); 3243 jQuery('.azoom-woocommerce-cart-wrapper.azoom-woocommerce-box .azoom-woocommerce-box-content ul.cart_list > li').wrapInner('<div class="ajax-cart-content azoom-transition"></div>'); 3244 jQuery('.azoom-woocommerce-cart-wrapper .azoom-woocommerce-box-content ul.cart_list li .ajax-cart-content').each(function(){ 3245 var img = jQuery(this).find('a img'); 3246 var text = jQuery(this).find('a').not('.remove').text(); 3247 var span_el = jQuery(this).find('.quantity'); 3248 jQuery(this).find('a').not('.remove').html(img).append('<span class="text-overflow">'+text+'</span>'); 3249 jQuery(this).find('a').not('.remove').append(span_el).append(cart_link_html); 3250 }); 3251 } 3252 var last_item = return_new_item_in_cart(); 3253 3254 update_special_cart_icon_count(); 3255 3256 //TO DO : Bind to an option to activate/deactivate cart contents on "added to cart" 3257 if(display_cart_ar){ 3258 var delay_time = 1000; 3259 if(!is_box_active){ 3260 jQuery('.special-cart-container').trigger('click'); 3261 delay_time += 600; 3262 } 3263 3264 last_item.addClass('ajax-cart-animate-border azoom-transition'); 3265 setTimeout(function(){ 3266 setTimeout(function(){ 3267 if(is_box_active){ 3268 jQuery('.special-cart-container').trigger('click'); 3269 } 3270 },1500); 3271 last_item.removeClass('ajax-cart-animate-border'); 3272 },delay_time); 3273 } 3274 } 3275 3276 3277 3278 function update_special_cart_icon_count(){ 3279 var cart = jQuery('.special-cart-container .display-cart-count');
3280 var cart_con = jQuery('.special-cart-container'); 3281 var new_val = cart_con.find('.new_value').clone(); 3282 3283 if(cart.find('.cart-current-count.old').length){ 3284 3285 } 3286 3287 cart.append(new_val.html()); 3288 cart.find('.cart-current-count').first().addClass('old animated slideOutUpSmall');//.css({'top':'-50px'}) 3289 cart.find('.cart-current-count').last().addClass('animated bounceInUp'); 3290 3291 if(Modernizr.cssanimations){ 3292 3293 cart.find('.cart-current-count.old').on('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', function(){ 3294 cart.find('.cart-current-count.old').remove(); 3295 }); 3296 }else{ 3297 3298 cart.find('.cart-current-count.old').remove(); 3299 } 3300 3301 } 3302 3303 3304 3305 3306 3307 function init_woo_cart(){ 3308 jQuery('.azoom-woocommerce-cart-wrapper.azoom-woocommerce-box .azoom-woocommerce-box-content ul.cart_list').addClass('large-block-grid-3 medium-block-grid-2 small-block-grid-1'); 3309 jQuery('.azoom-woocommerce-cart-wrapper.azoom-woocommerce-box .azoom-woocommerce-box-content ul.cart_list > li').wrapInner('<div class="ajax-cart-content azoom-transition"></div>'); 3310 jQuery('.azoom-woocommerce-cart-wrapper .azoom-woocommerce-box-content ul.cart_list li .ajax-cart-content').each(function(){ 3311 var img = jQuery(this).find('a img'); 3312 var text = jQuery(this).find('a').not('.remove').text(); 3313 var span_el = jQuery(this).find('.quantity'); 3314 jQuery(this).find('a').not('.remove').html(img).append('<span class="text-overflow">'+text+'</span>'); 3315 jQuery(this).find('a').not('.remove').append(span_el).append(cart_link_html); 3316 }); 3317 3318 woo_initialized = true; 3319 } 3320 3321 if(jQuery(window).width() >= 800 || jQuery(window).height() >= 800){ 3322 jQuery(document).on('added_to_cart', update_woo_cart_contents); 3323 } 3324 3325 //Mobile Cart icon for tablets 3326 if(jQuery('.mobile-cart-holder').length){ 3327 jQuery(document).on('click', '.mobile-cart-holder', function(e){ 3328 if(jQuery(this).hasClass('disabled')){ 3329 e.preventDefault(); 3330 return; 3331 } 3332 if(!woo_initialized){ 3333 //Initialize WooCommerce Cart for styling 3334 init_woo_cart(); 3335 } 3336 //Only enable cart contents if the width is enough. Otherwise, let the cart link work by disabling e.preventDefault(); 3337 if(jQuery(window).width() > 640){ 3338 e.preventDefault(); 3339 rockthemes_special_cart_motion(); 3340 } 3341 }); 3342 } 3343 3344 jQuery(document).on('click', '.special-cart-container', function(e){ 3345 if(jQuery(this).hasClass('disabled')){ 3346 e.preventDefault(); 3347 return; 3348 } 3349 if(!woo_initialized){ 3350 //Initialize WooCommerce Cart for styling 3351 init_woo_cart(); 3352 } 3353 e.preventDefault(); 3354 rockthemes_special_cart_motion(); 3355 }); 3356 3357 function rockthemes_special_cart_motion(){ 3358 is_box_active = underbox_menu_mask.hasClass('active woocommerce-cart-active') ? true : false; 3359 var to_all_button_cover = jQuery('.undermenu-box-button-cover'); 3360 3361 if(!is_box_active){ 3362 if(jQuery('.azoom-woocommerce-box-content li').length){ 3363 to_all_button_cover.addClass('active'); 3364 }else{ 3365 //When switching from search, it might left the button area open. Hide it. 3366 to_all_button_cover.removeClass('active'); 3367 } 3368 underbox_menu_mask.removeClass(remove_classes); 3369 underbox_menu_mask.addClass('active woocommerce-cart-active'); 3370 underbox_menu.addClass('animated slideInDownSmall'); 3371 is_box_active = true; 3372 underbox_menu_mask.css({'height':underbox_menu.height() + to_all_button_height}); 3373 }else{ 3374 //This is a search feature. 3375 if(Modernizr.cssanimations){ 3376 if(underbox_menu.height() + to_all_button_height < 400){ 3377 underbox_menu.removeClass('slideInDownSmall animated').addClass('animated slideOutUpSmall'); 3378 }else{ 3379 underbox_menu.removeClass('slideInDownSmall animated').addClass('animated slideOutUp'); 3380 } 3381 underbox_menu.on('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', remove_animation_classes); 3382 }else{ 3383 remove_animation_classes(); 3384 } 3385 } 3386 } 3387 3388 jQuery(document).on('click touchend', '.close-search-icon', function(e){ 3389 jQuery('.rockthemes-ajax-search-input').blur(); 3390 if(Modernizr.cssanimations){ 3391 if(underbox_menu.height() + to_all_button_height < 400){ 3392 underbox_menu.removeClass('slideInDownSmall animated').addClass('animated slideOutUpSmall'); 3393 }else{ 3394 underbox_menu.removeClass('slideInDownSmall animated').addClass('animated slideOutUp'); 3395 } 3396 underbox_menu.on('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', remove_animation_classes); 3397 }else{ 3398 remove_animation_classes(); 3399 } 3400 }); 3401 3402 function remove_animation_classes(){ 3403 underbox_menu_mask.removeClass('active woocommerce-cart-active').css('height','');//.slideUp(); 3404 jQuery('.rockthemes-ajax-search-input').val(''); 3405 underbox_menu.removeClass('animated slideOutUpSmall slideOutUp slideInDownSmall'); 3406 underbox_menu.off('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', remove_animation_classes); 3407 to_all_button_cover.removeClass('active'); 3408 is_box_active = false; 3409 } 3410 3411} 3412 3413 3414 3415function rockthemes_menu_ajax_search(){ 3416 var underbox_menu_mask = jQuery('.azoom-undermenu-mask');//Performance increase 3417 var underbox_menu = jQuery('.azoom-undermenu-box'); 3418 var is_box_active = false; 3419 var results_holder = jQuery('.ajax-search-results'); 3420 var to_all_button_cover = jQuery('.undermenu-box-button-cover'); 3421 var to_all_button = jQuery('.search-results-button'); 3422 var to_all_button_height = 63 + 10;//+10 for radius 3423 var remove_classes = ''; 3424 for (var r = 0; r < rockthemes.settings.undermenu_box_classes.length; r++){ 3425 if(rockthemes.settings.undermenu_box_classes[r] != 'search-box-active'){ 3426 remove_classes += rockthemes.settings.undermenu_box_classes[r]+' '; 3427 } 3428 } 3429 3430 jQuery(document).on('click', '.special-search-icon', function(e){
3431 e.preventDefault(); 3432 is_box_active = underbox_menu_mask.hasClass('active search-box-active') ? true : false; 3433 if(!is_box_active){ 3434 if(results_holder.find('li').length){ 3435 to_all_button_cover.addClass('active'); 3436 }else{ 3437 //When switching from woo, it might left the button area open. Hide it. 3438 to_all_button_cover.removeClass('active'); 3439 } 3440 underbox_menu.on('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', search_box_animation_ended); 3441 underbox_menu_mask.removeClass(remove_classes); 3442 underbox_menu_mask.addClass('active search-box-active');//.slideDown(); 3443 underbox_menu.addClass('animated slideInDownSmall'); 3444 underbox_menu_mask.css({'height':underbox_menu.height() + to_all_button_height}); 3445 is_box_active = true; 3446 }else{ 3447 jQuery('.rockthemes-ajax-search-input').blur(); 3448 if(Modernizr.cssanimations){ 3449 if(underbox_menu.height() + to_all_button_height < 400){ 3450 underbox_menu.removeClass('slideInDownSmall animated').addClass('animated slideOutUpSmall'); 3451 }else{ 3452 underbox_menu.removeClass('slideInDownSmall animated').addClass('animated slideOutUp'); 3453 } 3454 underbox_menu.on('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', remove_animation_classes); 3455 }else{ 3456 remove_animation_classes(); 3457 } 3458 } 3459 }) 3460 3461 jQuery(document).on('click', '.close-search-icon', function(e){ 3462 jQuery('.rockthemes-ajax-search-input').blur(); 3463 if(Modernizr.cssanimations){ 3464 if(underbox_menu.height() + to_all_button_height < 400){ 3465 underbox_menu.removeClass('slideInDownSmall animated').addClass('animated slideOutUpSmall'); 3466 }else{ 3467 underbox_menu.removeClass('slideInDownSmall animated').addClass('animated slideOutUp'); 3468 } 3469 underbox_menu.on('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', remove_animation_classes); 3470 }else{ 3471 remove_animation_classes(); 3472 } 3473 }); 3474 3475 function remove_animation_classes(){ 3476 underbox_menu_mask.removeClass('active search-box-active').css('height',''); 3477 jQuery('.rockthemes-ajax-search-input').val(''); 3478 results_holder.html(''); 3479 underbox_menu.removeClass('animated slideOutUpSmall slideOutUp slideInDownSmall'); 3480 underbox_menu.off('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', remove_animation_classes); 3481 to_all_button_cover.removeClass('active'); 3482 is_box_active = false; 3483 } 3484 3485 function search_box_animation_ended(){ 3486 underbox_menu.off('animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd', search_box_animation_ended); 3487 jQuery('.rockthemes-ajax-search-input').focus(); 3488 } 3489 3490 var keydown_timer; 3491 var search_text = ''; 3492 var searching_icon = jQuery('.ajax-loading-icon'); 3493 jQuery(document).on('keydown', '.rockthemes-ajax-search-input', function(e){ 3494 clearTimeout(keydown_timer); 3495 keydown_timer = setTimeout(function(){ 3496 search_text = jQuery('.rockthemes-ajax-search-input').val(); 3497 to_all_button.attr('href', rockthemes.home_url+'/?s='+search_text); 3498 if(search_text != '' && search_text.length > 1){ 3499 make_ajax_search(search_text); 3500 } 3501 }, 1080); 3502 }); 3503 3504
3505 function make_ajax_search(text){ 3506 searching_icon.parents('.azoom-ajax-search-wrapper').addClass('searching'); 3507 jQuery.post(rockthemes.ajaxurl, {action:'rockthemes_ajax_search', _ajax_nonce:rockthemes.nonces.asearch, search_term:text}, function(data){ 3508 searching_icon.parents('.azoom-ajax-search-wrapper').removeClass('searching'); 3509 results_holder.html(data); 3510 3511 if(results_holder.find('li').length){ 3512 to_all_button_cover.addClass('active'); 3513 } 3514 3515 underbox_menu_mask.stop(true, true).animate({'height':underbox_menu.height() + to_all_button_height},600); 3516 3517 }); 3518 3519 } 3520} 3521 3522 3523jQuery(window).load(function(){ 3524 3525 //Init Inline Navigation 3526 if(rockthemes.frontend_options.display_inline_nav == 'true' && jQuery('#rockthemes-inline-nav').length){ 3527 if(Modernizr.touch && (jQuery(window).width() <= 767 || jQuery(window).height() <= 800)){ 3528 //Remove Inline navigation if the screen size is small 3529 jQuery('#rockthemes-inline-nav').remove(); 3530 }else{ 3531 //Delay it for smooth show 3532 setTimeout(function(){ 3533 rockthemes_inline_nav(); 3534 }, 1500); 3535 } 3536 } 3537 3538 rockthemes_activate_gototop(); 3539 3540 //Activate Animations of elements (Uses css/animate.css file) 3541 rockthemes_activate_animations(); 3542 3543 //Buttons and regular links for inline navigation 3544 rockthemes_button_link_inline_navigation(); 3545 3546 if(rockthemes.menu.enable_menu_hash_navigation == 'true'){ 3547 rockthemes_main_nav_inline_links(); 3548 } 3549 3550 jQuery('.rockthemes-video-bg').each(function(){ 3551 var that = jQuery(this); 3552 //Start it if it's visible 3553 that.find('video[data-autoplay="true"]\\:in-viewport').do(function(){ 3554 jQuery(this)[0].play(); 3555 }); 3556 3557 //Add To The Scroll Event 3558 jQuery(window).scroll(function(){ 3559 that.find('video[data-autoplay="true"]\\:in-viewport').do(function(){ 3560 jQuery(this)[0].play(); 3561 }); 3562 }); 3563 }); 3564 3565 //Activate Masonry & Activate Portfolio Elements animation without masonry. 3566 //TO DO : Bind none animated element to appear or some other function 3567 rockthemes_activate_portfolio(); 3568 3569 3570 rockthemes_display_not_visible_elements(); 3571 3572 3573 //Init Sticky Header 3574 rockthemes_sticky_header_init(); 3575 3576 3577 //Quick fix. First size is not correct for mobile devices. 3578 if(jQuery('.azoom-title-breadcrumbs.rockthemes-parallax').length && Modernizr.ismobile){ 3579 //rockthemes_parallax_bg_image(jQuery('.azoom-title-breadcrumbs.rockthemes-parallax')); 3580 } 3581 3582 3583 /* 3584 ** Activate Lightbox Effect 3585 ** 3586 ** Lightbox will need to be activated after window.load. Otherwise gallery mode does not work 3587 */ 3588 rockthemes_activate_lightbox(); 3589 3590 jQuery(document).trigger('rockthemes:mega_menu_resize'); 3591}); 3592 3593function rockthemes_activate_gototop(){ 3594 //Return if not enabled 3595 if(jQuery('#azoom-go-to-top').length < 1) return; 3596 3597 jQuery(window).scroll(function() { 3598 if(jQuery(this).scrollTop() > 480) { 3599 jQuery('#azoom-go-to-top').css({'opacity':'1', 'visibility':'visible'}); 3600 } else { 3601 jQuery('#azoom-go-to-top').css({'opacity':'', 'visibility':''}); 3602 } 3603 }); 3604 3605 jQuery('#azoom-go-to-top').click(function() { 3606 jQuery('body,html').animate({scrollTop:0},800); 3607 }); 3608} 3609 3610 3611//Specially for Vimeo. It starts with buttons. This delay will hide it 3612function rockthemes_display_not_visible_elements(){ 3613 if(typeof rockthemes.visibility_hidden_elements == 'undefined' || !rockthemes.visibility_hidden_elements) return; 3614 3615 var els = rockthemes.visibility_hidden_elements; 3616 for(var i=0;i<els.length;i++){ 3617 els[i].css({'visibility':'visible'}); 3618 if(els[i].hasClass('not-visible')){ 3619 els[i].removeClass('not-visible'); 3620 } 3621 } 3622} 3623 3624 3625 3626function rockthemes_button_link_inline_navigation(){ 3627 jQuery('.rockthemes-inline-link').each(function(){ 3628 3629 var that = jQuery(this), 3630 this_hash = that.attr('href').replace(/.*?\#/,''), 3631 wp_nav_height = 0, 3632 time = 1000; 3633 3634 if(rockthemes.frontend_options.is_admin_bar_showing){ 3635 wp_nav_height = jQuery('#wpadminbar').outerHeight(); 3636 } 3637 3638 3639 that.click(function(e){ 3640 3641 e.preventDefault(); 3642 3643 if(jQuery('#'+this_hash).length < 1) return; 3644 3645 var top_val = jQuery('#'+this_hash).offset().top + wp_nav_height; 3646 top_val = top_val - parseInt(rockthemes.menu.sticky_height); 3647 3648 jQuery(document).trigger('rockthemes:scroll_events_disable'); 3649 jQuery('html, body').animate({'scrollTop': top_val}, time, 'easeInOutQuart', function(){ 3650 setTimeout(function(){ 3651 if(history.pushState) { 3652 history.pushState(null, null, '#'+this_hash); 3653 } 3654 else { 3655 location.hash = this_hash; 3656 } 3657 },100); 3658 jQuery(document).trigger('rockthemes:scroll_events_enable'); 3659 }); 3660 3661 }); 3662 }); 3663} 3664 3665 3666/* 3667** Rockthemes - Main Menu Inline Navigation 3668** 3669** @since : 1.3 3670*/ 3671function rockthemes_main_nav_inline_links(){ 3672 var rtm_nav = jQuery('#rtm-navigation'); 3673 var hash_links = jQuery('#rtm-navigation a, #rnmm li > a').filter(function(){ 3674 return typeof jQuery(this).attr('href') != 'undefined' && jQuery(this).attr('href').indexOf('#') > -1; 3675 }); 3676 3677 3678 3679 rockthemes_main_nav_inline_nav_events(hash_links); 3680 3681 if(hash_links.length < 1) return; 3682 3683 var init_ended = false; 3684 3685 var wp_nav_height = 0; 3686 if(rockthemes.frontend_options.is_admin_bar_showing){ 3687 wp_nav_height = jQuery('#wpadminbar').outerHeight(); 3688 } 3689 3690 var moving = false; 3691 3692 //Activate navigation click 3693 hash_links.click(function(e){
3694 3695 moving = true; 3696 3697 var this_hash = jQuery(this).attr('href').replace(/.*?\#/,''); 3698 3699 if( jQuery(this).attr('href').charAt(0) == '#' || jQuery(this).attr('href').split('#')[0] == window.location.href.split('#')[0]){ 3700 e.preventDefault(); 3701 }else{ 3702 return; 3703 } 3704 3705 var time = 1000; 3706 if(rtm_nav.find('li.active').length){ 3707 time = Math.abs(parseInt(rtm_nav.find('li.active').index()) - jQuery(this).index()) * 1000; 3708 3709 } 3710 3711 var top_val = jQuery('#'+this_hash).offset().top - wp_nav_height; 3712 if(jQuery('.header-sticky-active').length && jQuery('.sticky-header-wrapper').length && 3713 jQuery('.sticky-header-wrapper').offset().top < top_val && top_val - rockthemes.menu.sticky_height > 0){ 3714 top_val = top_val - parseInt(rockthemes.menu.sticky_height); 3715 } 3716 3717 if(rtm_nav.find('li.current-menu-item').length){ 3718 rtm_nav.find('li.current-menu-item').removeClass('current-menu-item'); 3719 } 3720 if(jQuery('#rnmm li.current-menu-item').length){ 3721 jQuery('#rnmm li.current-menu-item').removeClass('current-menu-item'); 3722 } 3723 if(jQuery(this).parents('li').length){ 3724 jQuery(this).parents('li').addClass('current-menu-item'); 3725 } 3726 3727 jQuery(document).trigger('rockthemes:scroll_events_disable'); 3728 jQuery('html, body').animate({'scrollTop': top_val}, time, 'easeInOutQuart', function(){ 3729 setTimeout(function(){ 3730 if(history.pushState) { 3731 history.pushState(null, null, '#'+this_hash); 3732 } 3733 else { 3734 location.hash = this_hash; 3735 } 3736 moving=false; 3737 },100); 3738 jQuery(document).trigger('rockthemes:scroll_events_enable'); 3739 }); 3740 }); 3741 3742 var dt;//Debounce Timer 3743 jQuery(document).on('rockthemes:in_view_main_nav', function(e, elem, h, li){ 3744 3745 if(moving) return; 3746 3747 var _li = rtm_nav.find('#'+li); 3748 var rd = (_li.index() == 0) ? 0 : 0 + wp_nav_height; // Required Difference 3749 var top_val = jQuery('#'+h).offset().top ; 3750 var bottom_val = jQuery('#'+h).offset().top + jQuery('#'+h).height(); 3751 3752 if(jQuery('.sticky-header-wrapper').length ){ 3753 top_val = top_val - parseInt(rockthemes.menu.sticky_height); 3754 bottom_val = bottom_val - parseInt(rockthemes.menu.sticky_height); 3755 } 3756 3757 //Only chnage navigation if the element is at the top 3758 if((jQuery(window).scrollTop() + wp_nav_height) <= bottom_val && top_val - jQuery(window).scrollTop() <= rd){ 3759 if(!_li.hasClass('current-menu-item')){ 3760 rtm_nav.find('li.current-menu-item').removeClass('current-menu-item'); 3761 _li.addClass('current-menu-item'); 3762 } 3763 } 3764 }); 3765 3766} 3767function rockthemes_main_nav_inline_nav_events(elems){ 3768 elems.each(function(){ 3769 var that = jQuery(this); 3770 var en = that.attr('href').replace(/.*?\#/,''); //en refers to elem name 3771 if(!en.length) return; 3772 3773 3774 //For initial selected element 3775 var that_obj = new Object(); 3776 that_obj.data = {that:that, en:en, li:that.parents('li').attr('id')} 3777 rockthemes_main_nav_inline_nav_view_event(that_obj); 3778 3779 jQuery(window).on('scroll', that_obj.data, rockthemes_main_nav_inline_nav_view_event); 3780 }); 3781} 3782function rockthemes_main_nav_inline_nav_view_event(e){ 3783 jQuery('#'+e.data.en+'\\:in-viewport').do(function(){ 3784 3785 jQuery(document).trigger('rockthemes:in_view_main_nav', [e.data.that, e.data.en, e.data.li]); 3786 }); 3787} 3788 3789 3790 3791 3792/* 3793** Rockthemes Inline Navigation 3794** 3795** @since : 1.3 3796*/ 3797function rockthemes_inline_nav(){ 3798 var init_ended = false; 3799 3800 var wp_nav_height = 0; 3801 if(rockthemes.frontend_options.is_admin_bar_showing){ 3802 wp_nav_height = jQuery('#wpadminbar').outerHeight(); 3803 } 3804 3805 //Activate navigation click 3806 jQuery('#rockthemes-inline-nav li').click(function(e){ 3807 var this_hash = jQuery(this).attr('id').replace('rin-',''); 3808 3809 var time = 1000; 3810 if(jQuery('#rockthemes-inline-nav li.active').length){ 3811 time = Math.abs(parseInt(jQuery('#rockthemes-inline-nav li.active').index()) - jQuery(this).index()) * 1000; 3812 3813 } 3814 3815 3816 var top_val = jQuery('#'+this_hash).offset().top - wp_nav_height; 3817 if(jQuery('.header-sticky-active').length && jQuery('.sticky-header-wrapper').length && 3818 jQuery('.sticky-header-wrapper').offset().top < top_val && top_val - rockthemes.menu.sticky_height > 0){ 3819 top_val = top_val - parseInt(rockthemes.menu.sticky_height); 3820 } 3821 3822 3823 jQuery(document).trigger('rockthemes:scroll_events_disable'); 3824 jQuery('html, body').animate({'scrollTop': top_val}, time, 'easeInOutQuart', function(){ 3825 setTimeout(function(){ 3826 if(history.pushState) { 3827 history.pushState(null, null, '#'+this_hash); 3828 } 3829 else { 3830 location.hash = this_hash; 3831 } 3832 },100); 3833 jQuery(document).trigger('rockthemes:scroll_events_enable'); 3834 }); 3835 }); 3836 3837 var dt; //Delete Timer 3838 jQuery(document).on('rockthemes:in_view_nav', function(e, elem, id){ 3839 if(!init_ended) return; 3840 var rd = (elem.index() == 0) ? 40 : 10 + wp_nav_height; // Required Difference 3841 var top_val = jQuery('#'+id).offset().top; 3842 3843 if(jQuery('.main-header-area').length && jQuery('.main-header-area').offset().top < top_val && top_val - rockthemes.menu.sticky_height > 0){ 3844 top_val = top_val - parseInt(rockthemes.menu.sticky_height); 3845 } 3846 3847 3848 3849 //Only chnage navigation if the element is at the top 3850 if(top_val - jQuery(window).scrollTop() <= rd){ 3851 if(!jQuery('#rin-'+id).hasClass('active')){ 3852 clearTimeout(dt); 3853 jQuery('#rockthemes-inline-nav li.active').removeClass('active title-active'); 3854 jQuery('#rin-'+id).addClass('active title-active'); 3855 dt = setTimeout(function(){ 3856 jQuery('#rin-'+id).removeClass('title-active'); 3857 },1500); 3858 } 3859 } 3860 }); 3861 3862 3863 //Initialize Inline Navigation 3864 jQuery('#rockthemes-inline-nav').css('top', parseInt((parseInt(j
3864Query(window).height() - (jQuery('#rockthemes-inline-nav').height() - 30)) / 2))+'px'); 3865 jQuery(window).smartresize(function(){ 3866 jQuery('#rockthemes-inline-nav').css('top', parseInt((parseInt(jQuery(window).height() - (jQuery('#rockthemes-inline-nav').height() - 30)) / 2))+'px'); 3867 }); 3868 3869 var inl = jQuery('#rockthemes-inline-nav li').length; // Inline Nav Length 3870 3871 jQuery(document).on('rockthemes:start_inline_nav', function(){ 3872 jQuery('#rockthemes-inline-nav li.deactive').each(function(i,elem){ 3873 var that = jQuery(this); 3874 setTimeout(function(){ 3875 that.removeClass('deactive'); 3876 if((parseInt(inl) - i) <= 1){ 3877 init_ended = true; 3878 dt = setTimeout(function(){ 3879 rockthemes_inline_nav_events(true); 3880 },100); 3881 } 3882 }, parseInt(100 * i)); 3883 }); 3884 }); 3885 3886 jQuery(document).on('rockthemes:hide_inline_nav', function(){ 3887 jQuery('#rockthemes-inline-nav li').each(function(i,elem){ 3888 var that = jQuery(this); 3889 setTimeout(function(){ 3890 that.addClass('deactive'); 3891 if((parseInt(inl) - i) <= 1){ 3892 init_ended = true; 3893 dt = setTimeout(function(){ 3894 rockthemes_inline_nav_events(false); 3895 },100); 3896 } 3897 }, parseInt(100 * i)); 3898 }); 3899 }); 3900 3901 //Main Starter 3902 jQuery(document).trigger('rockthemes:start_inline_nav'); 3903} 3904 3905function rockthemes_inline_nav_events(on_add){ 3906 on_add = (typeof on_add != 'undefined' && on_add) ? true : false; 3907 3908 jQuery('#rockthemes-inline-nav li').each(function(){ 3909 var that = jQuery(this); 3910 var en = that.attr('id').replace('rin-',''); //en refers to elem name 3911 3912 if(on_add){ 3913 var that_obj = new Object(); 3914 that_obj.data = {that:that, en:en} 3915 rockthemes_inline_nav_view_event(that_obj); 3916 } 3917 3918 if(on_add){ 3919 jQuery(window).on('scroll', {that:that,en:en}, rockthemes_inline_nav_view_event); 3920 }else{ 3921 3922 jQuery(window).off('scroll', rockthemes_inline_nav_view_event); 3923 } 3924 }); 3925 3926 if(on_add){ 3927 jQuery('#rockthemes-inline-nav').addClass('initialized'); 3928 }else{ 3929 jQuery('#rockthemes-inline-nav.initialized').removeClass('initialized'); 3930 } 3931} 3932function rockthemes_inline_nav_view_event(e){ 3933 jQuery('#'+e.data.en+'\\:in-viewport').do(function(){ 3934 jQuery(document).trigger('rockthemes:in_view_nav', [e.data.that, e.data.en]); 3935 }); 3936} 3937 3938 3939 3940 3941 3942function rockthemes_mobile_menu(){ 3943 if(rockthemes.frontend_options.header_location == 'top_navigation' && (rockthemes.resposivity === 'false' || jQuery('html').hasClass('ie9'))) return; 3944 3945 //mm refers to mobile menu 3946 var mm = jQuery('#rtm-navigation').clone(true); 3947 3948 mm.wrapInner('<div id="rockthemes_mobile_menu"></div>'); 3949 mm = mm.find('#rockthemes_mobile_menu').unwrap(); 3950 3951 mm.find('#nav').replaceWith(jQuery('<nav id="rnmm">'+mm.find('#nav').html()+'</nav>')); 3952 3953 mm.find('.subtitle').remove(); 3954 mm.find('.dismiss-mobile').remove(); 3955 mm.find('.nav-icon').unwrap(); 3956 mm.find('.nav-menu').removeClass('nav-menu'); 3957 mm.find('.rtm-menu').removeClass('rtm-menu'); 3958 mm.find('.columns').removeClass('columns'); 3959 mm.find('.megamenu').removeClass('megamenu'); 3960 mm.find('.regularmenu').removeClass('regularmenu'); 3961 mm.find('.menu-item').removeClass('menu-item'); 3962 mm.find('.dismiss-icon').remove(); 3963 mm.find('.rtm-menu-sticker').remove(); 3964 mm.find('.description').remove(); 3965 3966 mm.find('.rtm-widget').remove(); 3967 mm.find('hr').remove(); 3968 mm.find('*[data-mm-align]').removeAttr('data-mm-align'); 3969 mm.find('*[data-mm-width]').removeAttr('data-mm-width'); 3970 3971 mm.find('.mobile-icon').each(function(){ 3972 if(jQuery(this).parent().parent().hasClass('heading-nav')){ 3973 jQuery(this).remove(); 3974 }else{ 3975 jQuery(this).parent().prepend('<i class="'+jQuery(this).attr('data-mobile-icon')+'"></i>'); 3976 } 3977 }); 3978 3979 mm.find('.heading-label.link-disabled').each(function(){ 3980 var tmm = jQuery(this); 3981 tmm.find('.heading-nav > .azoom-heading-icon').remove(); 3982 tmm.find('.heading-nav > h3').children().unwrap(); 3983 tmm.find('.heading-nav').wrap('<a href="#"></a>'); 3984 tmm.find('.heading-nav').children().unwrap(); 3985 }); 3986 3987 //Widget titles are using a different h3 system. Unwrap them 3988 mm.find('.rtm-has-widget h3.widget-title').contents().unwrap(); 3989 3990 for(var i = 1; i<13; i++){ 3991 mm.find('.rtm-menu-depth-'+i).removeClass('rtm-menu-depth-'+i); 3992 mm.find('.large-'+i).removeClass('large-'+i); 3993 mm.find('.medium-'+i).removeClass('medium-'+i); 3994 mm.find('.small-'+i).removeClass('small-'+i); 3995 } 3996 3997 mm.find('li > ul').each(function(){ 3998 var h2_clone = jQuery(this).parent().find(' > a').clone(); 3999 }); 4000 4001 mm.find('.current-menu-item').addClass('Selected'); 4002 4003 var mm_api;//When mm defined, this variable will hold the api 4004 4005 //Only add footer if the side navigation is available 4006 var mmenu_settings = { 4007 offCanvas: { 4008 position: rockthemes.is_rtl === 'rtl' ? 'right' : 'left' 4009 }, 4010 navbar : { 4011 title:rockthemes.mobile_menu.main_title 4012 }, 4013 navbars: [], 4014 slidingSubmenus:true, 4015 }; 4016 4017 if(rockthemes.frontend_options.header_location === 'side_navigation'){ 4018 4019 mmenu_settings.navbars.push({ 4020 position: 'bottom', 4021 content: '' 4022 }); 4023 4024 mmenu_settings.navbars.push({ 4025 position:'top',
4026 content:'', 4027 }); 4028 } 4029 4030 //Makes the menu open light and fast in mobile devices 4031 if(rockthemes.frontend_options.header_location == 'top_navigation'){ 4032 4033 } 4034 4035 if(jQuery(window).width() < 1024 || rockthemes.frontend_options.header_location === 'side_navigation'){ 4036 jQuery('body').append(mm); 4037 jQuery('#rnmm').mmenu(mmenu_settings); 4038 mm_api = jQuery('#rnmm').data('mmenu'); 4039 jQuery('body').addClass('mobile-menu-added'); 4040 jQuery('#rockthemes_mobile_menu').remove(); 4041 }else{ 4042 jQuery(window).smartresize(function(){ 4043 if(jQuery(window).width() < 1024 && !jQuery('body').hasClass('mobile-menu-added')){ 4044 jQuery('body').append(mm); 4045 jQuery('#rnmm').mmenu(mmenu_settings); 4046 mm_api = jQuery('#rnmm').data('mmenu'); 4047 jQuery('body').addClass('mobile-menu-added'); 4048 jQuery('#rockthemes_mobile_menu').remove(); 4049 } 4050 }); 4051 } 4052 4053 4054 //Disabling regular menu 4055 if(rockthemes.menu.main_menu_model == 'menu_use_mobile_for_main'){ 4056 4057 //Set the style 4058 jQuery('html').addClass('menu_use_mobile_for_main'); 4059 4060 //Remove main menu 4061 jQuery('#rtm-navigation').remove(); 4062 } 4063 4064 4065 if(rockthemes.frontend_options.header_location === 'side_navigation'){ 4066 4067 var h_height = 0; 4068 var f_height = 0; 4069 4070 jQuery('html').addClass('side_nav_menu'); 4071 var m_logo = jQuery('.logo-container').clone(); 4072 var m_ht2 = jQuery('.header-top-2').clone(); 4073 m_ht2.removeClass('hide'); 4074 jQuery('.header-all-wrapper').children().each(function(){ 4075 if(jQuery(this).hasClass('azoom-title-breadcrumbs')) return; 4076 jQuery(this).remove(); 4077 }); 4078 4079 //Remove header area from the inline navigation 4080 if(jQuery('#rockthemes-inline-nav').length){ 4081 jQuery('#rockthemes-inline-nav .rockthemes-inline-nav-elem').each(function(){ 4082 if(jQuery('#'+jQuery(this).attr('id').toString().replace('rin-','')).length < 1){ 4083 jQuery(this).remove(); 4084 } 4085 }); 4086 } 4087 4088 if(m_ht2.hasClass('not-visible')){ 4089 m_ht2.removeClass('not-visible'); 4090 } 4091 m_ht2.find('.not-visible').removeClass('not-visible'); 4092 m_ht2.find('.columns').css('width','100%'); 4093 4094 jQuery('.mm-navbar-top').prepend(m_logo); 4095 jQuery('.mm-menu .mm-navbar-bottom').append(m_ht2); 4096 4097 var h_height = jQuery('.mm-navbar-top').height(); 4098 var f_height = jQuery('.mm-navbar-bottom').height(); 4099 var n_height = jQuery('#rnmm').height(); 4100 4101 jQuery('.mm-navbar-top').imagesLoaded(function(){ 4102 rockthemes_mobile_menu_side_resize(); 4103 }); 4104 4105 //Mobile version switcher 4106 jQuery('body').append( 4107 jQuery('<div id="mobile-menu-list-icon" class="mm-slideout">'+ 4108 '<span></span>'+ 4109 '</div>') 4110 ); 4111 4112 jQuery(window).resize(function(){ 4113 rockthemes_mobile_menu_side_resize(); 4114 if(typeof mm_api != 'undefined'){ 4115 mm_api.close(); 4116 } 4117 }); 4118 } 4119 4120 4121 // Base expand 4122 jQuery(document).on('click touchend', '.mobile-menu-switcher-holder, #mobile-menu-list-icon', function(e){ 4123 e.preventDefault(); 4124 4125 jQuery(document).trigger('rockthemes:mobile_menu_expand'); 4126 4127 //jQuery( '#rnmm' ).trigger("open.mm"); 4128 if(typeof mm_api != 'undefined'){ 4129 mm_api.open(); 4130 } 4131 }); 4132 4133 4134} 4135 4136/* 4137** Mobile Menu Used in left Side will need to resize some elements 4138** 4139** @return : void 4140*/ 4141function rockthemes_mobile_menu_side_resize(){ 4142 //We add 140 more for minimum required height 4143 var _h = parseInt(jQuery('.mm-navbar-bottom').height()) + parseInt(jQuery('.mm-navbar-top').height()) + 140; 4144 4145 if(jQuery('#rnmm').height() < _h){ 4146 jQuery('.logo-container').css({'display':'none'}); 4147 }else if(jQuery('.logo-container').css('display') === 'none'){ 4148 jQuery('.logo-container').css({'display':''}); 4149 } 4150 4151 var h_height = jQuery('.mm-navbar-top').outerHeight(), 4152 f_height = jQuery('.mm-navbar-bottom').outerHeight(), 4153 n_height = jQuery('#rnmm').height(), 4154 list_height = n_height - h_height; 4155 4156 if(jQuery('.mm-navbar-bottom').length && f_height){ 4157 list_height = list_height - f_height; 4158 } 4159 4160 if(parseInt(jQuery('.mm-navbar-bottom').css('bottom')) !== 0){ 4161 f_height = f_height + parseInt(jQuery('.mm-navbar-bottom').css('bottom')); 4162 } 4163
4164 if(parseInt(jQuery('.mm-navbar-bottom').css('bottom')) !== 0){ 4165 f_height = f_height + parseInt(jQuery('.mm-navbar-bottom').css('bottom')); 4166 } 4167 jQuery('#rnmm > .mm-panel').css({'padding':'0px', 'top':h_height+'px', 'height':list_height+'px'}); 4168} 4169 4170 4171 4172 4173 4174 4175 4176 4177/* 4178** Sticky Header Configuration 4179** 4180*/ 4181 4182function rockthemes_sticky_header_init(){ 4183 var header = jQuery('.main-header-area'); 4184 if(header.length < 1) return; 4185 if(!header.hasClass('header-sticky')) return; 4186 4187 4188 var wp_nav_height = 0; 4189 if(rockthemes.frontend_options.is_admin_bar_showing){ 4190 wp_nav_height = jQuery('#wpadminbar').outerHeight(); 4191 } 4192 4193 header.parents('.sticky-header-wrapper').css('height', header.height()+'px'); 4194 4195 var starting_point = header.parents('.sticky-header-wrapper').offset(); 4196 4197 4198 if(rockthemes.frontend_options.is_admin_bar_showing){ 4199 starting_point.top -= wp_nav_height; 4200 } 4201 4202 starting_point.bottom = parseInt(starting_point.top + header.parents('.sticky-header-wrapper').height()); 4203 4204 4205 4206 //Header top element's will change the coordinates of sticky wrapper. Thus header top elements will trigger this event 4207 jQuery(document).on('rockthemes:sticky_menu_resize', function(){ 4208 starting_point = header.parents('.sticky-header-wrapper').offset(); 4209 if(rockthemes.frontend_options.is_admin_bar_showing){ 4210 starting_point.top -= 28; 4211 } 4212 starting_point.bottom = parseInt(starting_point.top + header.parents('.sticky-header-wrapper').height()); 4213 4214 4215 }); 4216 4217 4218 jQuery(window).smartresize(function(){ 4219 jQuery(document).trigger('rockthemes:sticky_menu_resize'); 4220 }); 4221 4222 var sticky_active = false; 4223 var sticky_animated = false; 4224 4225 jQuery(window).scroll(function(){ 4226 /* 4227 ** Currently Not Used. 4228 ** Curvy Slider Fullscreen and Full Width Special Grid breaks the starting coords. 4229 ** Currently we are using this method to avoid any async element size changes. 4230 ** 4231 */ 4232 4233 if(jQuery(this).scrollTop() > starting_point.top){ 4234 if(!sticky_active){ 4235 header.addClass('header-sticky-active'); 4236 if(header.parents('.sticky-header-wrapper').length){ 4237 header.parents('.sticky-header-wrapper').addClass('wrapper-unsticky'); 4238 } 4239 jQuery('.header-all-wrapper').addClass('sticky-activated'); 4240 sticky_active = true; 4241 } 4242 4243 if(jQuery(this).scrollTop() > starting_point.bottom) { 4244 if(!sticky_animated){ 4245 sticky_animated = true; 4246 4247 setTimeout(function(){ 4248 header.addClass('header-sticky-animate'); 4249 },30); 4250 } 4251 }else if(jQuery(this).scrollTop() <= starting_point.bottom) { 4252 if(sticky_animated){ 4253 header.removeClass('header-sticky-animate'); 4254 sticky_animated = false; 4255 } 4256 } 4257 4258 }else if(jQuery(this).scrollTop() <= starting_point.top ) { 4259 if(!sticky_active) return; 4260 4261 header.removeClass('header-sticky-active'); 4262 if(header.parents('.sticky-header-wrapper').length){ 4263 header.parents('.sticky-header-wrapper').removeClass('wrapper-unsticky'); 4264 } 4265 jQuery('.header-all-wrapper').removeClass('sticky-activated'); 4266 sticky_active = false; 4267 4268 if(!sticky_animated) return; 4269 if(jQuery(this).scrollTop() <= starting_point.bottom) { 4270 setTimeout(function(){ 4271 header.removeClass('header-sticky-animate'); 4272 sticky_animated = false; 4273 },20); 4274 } 4275 } 4276 4277 }); 4278} 4279 4280 4281 4282 4283 4284/* 4285** RPB can use multiple gradient background colors. This function generates a background 4286** linear color with Browser prefix. 4287** 4288*/ 4289function rockthemes_multi_bg_colors(){ 4290 4291 if(jQuery('.multi-bg-colors').length < 0) return; 4292 4293 var spfx = rockthemes.frontend_options.style_prefix, 4294 value = '', 4295 is_responsive = jQuery(window).width() >= 800 ? false : true, 4296 flow = !is_responsive ? 'left' : 'top', 4297 size_l = '50', 4298 size_r = '50'; 4299 4300 4301 jQuery('.multi-bg-colors').each(function(){ 4302 var mbg = jQuery(this); 4303 var mbc = mbg.attr('data-multibg-colors'); 4304 if(typeof mbc == 'undefined') return; 4305 4306 var mbca = mbc.split(','); 4307 4308 if(spfx.indexOf('ms') > -1){ 4309 value = spfx+'linear-gradient('+flow+', '+mbca[0]+' '+size_l+'%, '+mbca[1]+' '+size_r+'%)'; 4310 }else{ 4311 value = spfx+'linear-gradient('+flow+', '+mbca[0]+' '+size_l+'%, '+mbca[1]+' '+size_r+'%)'; 4312 } 4313 4314 if(is_responsive){ 4315 mbg.css('background',mbca[0]); 4316 }else{ 4317 mbg.css('background-image', value); 4318 } 4319 }); 4320} 4321 4322 4323 4324 4325 4326 4327/*External Libraries*/ 4328 4329 4330 4331 4332/* 4333Plugin: jQuery Parallax 4334Version 1.1.3 4335Author: Ian Lunn 4336Twitter: @IanLunn 4337Author URL: http://www.ianlunn.co.uk/ 4338Plugin URL: http://www.ianlunn.co.uk/plugins/jquery-parallax/ 4339 4340Dual licensed under the MIT and GPL licenses: 4341http://www.opensource.org/licenses/mit-license.php 4342http://www.gnu.org/licenses/gpl.html 4343*/ 4344(function( $ ){ 4345 var $window = $(window); 4346 var windowHeight = $window.height(); 4347 4348 $window.resize(function () { 4349 windowHeight = $window.height(); 4350 }); 4351 4352 $.fn.parallax = function(xpos, speedFactor, outerHeight) { 4353 var $this = $(this); 4354 var getHeight; 4355 var firstTop; 4356 var paddingTop = 0; 4357 4358 //get the starting position of each element to have parallax applied to it 4359 $this.each(function(){ 4360 firstTop = $this.offset().top; 4361 }); 4362 4363 // setup defaults if arguments aren't specified 4364 if (arguments.length < 1 || xpos === null) xpos = "50%"; 4365 if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; 4366 if (arguments.length < 3 || outerHeight === null) outerHeight = true; 4367 4368 if (outerHeight) { 4369 getHeight = function(jqo) { 4370 return jqo.outerHeight(true); 4371 }; 4372 } else { 4373 getHeight = function(jqo) { 4374 return jqo.height(); 4375 }; 4376 } 4377 4378 // function to be called whenever the window is scrolled or resized
4379 function update(){ 4380 var pos = $window.scrollTop(); 4381 4382 $this.each(function(){ 4383 var $element = $(this); 4384 var top = $element.offset().top; 4385 var height = getHeight($element); 4386 4387 // Check if totally above or totally below viewport 4388 if (top + height < pos || top > pos + windowHeight) { 4389 return; 4390 } 4391 4392 /* 4393 ** Do not let the background image to above or below the content area 4394 ** 4395 ** @author : XanderRock 4396 */ 4397 var new_pos = Math.round(($this.offset().top - pos) * speedFactor), 4398 ih_obj = parseInt($this.attr('data-image-main-height')); 4399 4400 4401 if((new_pos > 0 && new_pos > ($this.offset().top - pos)) || new_pos + ih_obj < windowHeight) return; 4402 4403 $this.css('backgroundPosition', xpos + " " + new_pos + "px"); 4404 }); 4405 } 4406 4407 $window.on('scroll', update).resize(update); 4408 update(); 4409 }; 4410})(jQuery); 4411 4412 4413 4414 4415 4416 4417var BrowserDetect = { 4418 init: function () { 4419 this.browser = this.searchString(this.dataBrowser) || "Other"; 4420 this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "Unknown"; 4421 }, 4422 searchString: function (data) { 4423 for (var i = 0; i < data.length; i++) { 4424 var dataString = data[i].string; 4425 this.versionSearchString = data[i].subString; 4426 4427 if (dataString.indexOf(data[i].subString) !== -1) { 4428 return data[i].identity; 4429 } 4430 } 4431 }, 4432 searchVersion: function (dataString) { 4433 var index = dataString.indexOf(this.versionSearchString); 4434 if (index === -1) { 4435 return; 4436 } 4437 4438 var rv = dataString.indexOf("rv:"); 4439 if (this.versionSearchString === "Trident" && rv !== -1) { 4440 return parseFloat(dataString.substring(rv + 3)); 4441 } else { 4442 return parseFloat(dataString.substring(index + this.versionSearchString.length + 1)); 4443 } 4444 }, 4445 4446 dataBrowser: [ 4447 {string: navigator.userAgent, subString: "Chrome", identity: "Chrome"}, 4448 {string: navigator.userAgent, subString: "MSIE", identity: "Explorer"}, 4449 {string: navigator.userAgent, subString: "Trident", identity: "Explorer"}, 4450 {string: navigator.userAgent, subString: "Firefox", identity: "Firefox"}, 4451 {string: navigator.userAgent, subString: "Safari", identity: "Safari"}, 4452 {string: navigator.userAgent, subString: "Opera", identity: "Opera"} 4453 ] 4454 4455}; 4456BrowserDetect.init(); 4457 4458 4459 4460 4461//If SVG not supported replace it with png 4462jQuery.fn.rockthemes_svg_control = function(){ 4463 if(!Modernizr) return; 4464 if(!Modernizr.svg) { 4465 jQuery('img[src*="svg"].use_svg').attr('src', function() { 4466 return jQuery(this).attr('src').replace('.svg', '.png'); 4467 }); 4468 } 4469}
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.