/*================================================================*/ /* REFRESH IF WINDOW IS UNDER OR OVER 849 PX WIDE - works alone - /* remove from live site, Actual DEVICES work without this, read instructions.html to learn more. /*================================================================*/ var ww = $(window).width(); var limit = 849; function refresh() { ww = $(window).width(); var w = ww < limit ? (location.reload(true)) : (ww > limit ? (location.reload(true)) : ww = limit); } var tOut; $(window).resize(function () { var resW = $(window).width(); clearTimeout(tOut); if ((ww > limit && resW < limit) || (ww < limit && resW > limit)) { tOut = setTimeout(refresh, 100); } }); /*================================================================*/ /* BACK TO TOP with fixes for iPad - works alone /*================================================================*/ $(document).ready(function () { if (navigator.userAgent.indexOf('iPad', 'iPhone', 'iPod', 'Android', 'BlackBerry') == -1) { $(".backToTop").hide(); $(window).scroll(function () { if ($(this).scrollTop() > 100) { $('.backToTop').fadeIn(); } else { $('.backToTop').fadeOut(); } }); $('.backToTop').click(function () { $("html, body").animate({ scrollTop: 0 }, 800); return false; }); } var deviceAgent = navigator.userAgent.toLowerCase(); var agentID = deviceAgent.match(/(iphone|ipod|ipad|Android|BlackBerry)/); if (agentID) { $('.backToTop').css({ "position": "relative", "clear": "both", "margin": "0 auto", "width": "100%", "right": "auto", "bottom": "auto" }); $('.backToTop a').css({ "width": "100%", "-border-radius": "0px", "-webkit-border-radius": "0px" }); } }); //end back to top /*================================================================*/ /* SLIDE TO TOP ACCORDION /* works with: slide-to-top-accordion-min.js /*================================================================*/ //all closed $(document).ready(function() { $(".slide-to-top.all-closed").slideaccordion({ oneOpenedItem : true, open : -1 // 0 = first pane is open / -1 all are closed }); }); //initialize FIRST OPEN $(document).ready(function() { $(".slide-to-top.first-pane-open").slideaccordion({ oneOpenedItem : true, open : 0 // 0 = first pane is open / -1 all are closed }); }); /*================================================================*/ /* SEARCH - works alone /*================================================================*/ $(document).ready(function(){ $('.search #search-trigger').click(function(){ $('.search input').slideToggle('fast').focus(); $('.search #search-trigger').toggleClass('active'); }); }); /*================================================================*/ /* FORGOT PASSWORD (on login page) - works alone /*================================================================*/ $(document).ready(function () { $('.forgot-password').hide(); $('.forgotpw, .forgot-password .closeforgot').click(function () { $(".forgot-password").slideToggle('fast').focus(); }); }); /*================================================================*/ /* SMOOTH SCROLL to ANCHOR (DIV WITH ID) - works alone /*================================================================*/ $(document).ready(function ($) { $(".scrollto, .mobile-page-nav .btn").click(function (event) { event.preventDefault(); $('html,body').animate({ scrollTop: $(this.hash).offset().top }, 800); return false; }); }); /*================================================================*/ /* FADE ALL EXCEPT THE ONE YOU HOVERED - works alone /*================================================================*/ $(document).ready(function () { $('.image-widget li').hover(function () { $(this).siblings().addClass('fade'); }, function () { $(this).siblings().removeClass('fade'); }); }); /*================================================================*/ /* SCROLL MAGIC FOR FIXED HEADER AT 145px - works alone /*================================================================*/ if (document.documentElement.clientWidth > 767) { $(window).scroll(function () { var scroll = $(window).scrollTop(); if (scroll >= 145) { $(".menu_wrapper, body, .preheader").addClass("fixed"); } if (scroll <= 145) { $(".menu_wrapper, body, .preheader").removeClass("fixed"); } }); } // /*================================================================*/ /* SIMPLE ACCORDION works alone /*================================================================*/ $(document).ready(function () { $('.s-accordion li.s-wrap div.s-content').hide(); $('.s-accordion li.s-wrap .trigger a').click(function () { if ($(this).hasClass('active')) { $(this).removeClass('active'); $(this).parent().next().slideUp(); } else { $('.s-accordion li.s-wrap .trigger a').removeClass('active'); $(this).addClass('active'); $('.s-accordion li.s-wrap div.s-content').slideUp(); $(this).parent().next().slideDown(); } return false; }); }); /*================================================================*/ /* EQUAL HEIGHTS: /*================================================================*/ //http://stackoverflow.com/questions/13029090/jquery-equal-height-responsive-div-rows // UP VOTE THIS GUY, he rocks $.fn.eqHeights = function(options) { var defaults = { child: false }; var options = $.extend(defaults, options); var el = $(this); if (el.length > 0 && !el.data('eqHeights')) { $(window).bind('resize.eqHeights', function() { el.eqHeights(); }); el.data('eqHeights', true); } if( options.child && options.child.length > 0 ){ var elmtns = $(options.child, this); } else { var elmtns = $(this).children(); } var prevTop = 0; var max_height = 0; var elements = []; elmtns.height('auto').each(function() { var thisTop = this.offsetTop; if (prevTop > 0 && prevTop != thisTop) { $(elements).height(max_height); max_height = $(this).height(); elements = []; } max_height = Math.max(max_height, $(this).height()); prevTop = this.offsetTop; elements.push(this); }); $(elements).height(max_height); }; $(window).load(function () { $('.equalHero, .equalHeight').eqHeights(); }); /*================================================================*/ /* ADD CLASSES TO VARIOUS THINGS TO FIX OLD IE - works alone /*================================================================*/ $(document).ready(function () { $(".sort li:first-child").addClass('first'); $(".sort li:last-child, .footerPosts li:last-child, .footerCredits ul li:last-child").addClass('last'); $(".features li:nth-child(odd)").addClass('odd'); $(".features li:nth-child(even)").addClass('even'); // see comments $('table.responsive').wrap('
'); $('table.responsive').before(' You may have to swipe or scroll table to view all content'); // works with designreset.css in the table classes before the media queries // and inside the media queries at the very bottom // This is a down and dirty responsive table, it puts a wrapper on it and gives some instruction to the user. // It actually works better IMO than the other stuff out there. And no, bootstrap as of 2.2.2 didn't have a responsive table solution. // Choose your type here: http://css-tricks.com/responsive-data-table-roundup/ // I made my own as it's consistent and less buggy. }); /*================================================================*/ /* FIT VIDEOS NOT USED IN SLIDERS /* works with: jquery.fitvid.js /*================================================================*/ $(document).ready(function () { $(".video-wrapper").fitVids(); }); /*================================================================*/ /* ROTATING TESTIMONIALS jquery.easytabs.js /*================================================================*/ $(document).ready(function () { $('.rotating-testimonials').easytabs({ animationSpeed: 400, updateHash: false, cycle: 5000 }); }); /*================================================================*/ /* SIDE BAR TABS jquery.easytabs.js /*================================================================*/ $(document).ready(function () { $('.sidebar-tabs').easytabs({ transitionIn: 'slideDown', updateHash: false }); }); /*================================================================*/ /* CONTENT TABS jquery.easytabs.js /*================================================================*/ $(document).ready(function () { $('.content-tabs').easytabs({ transitionIn: 'slideDown', updateHash: false }); }); /*================================================================*/ /* TOOL TIPS and POP OVERS bootstrap.min.js has inside it: /* bootstrap-tooltip.js, bootstrap-popover.js /*================================================================*/ $(document).ready(function () { $('.titletip, ul.social li a, .header .user a').tooltip({}); $(".detailsPop").popover({ trigger: 'hover' }); }); /*================================================================*/ /* TWITTER SLIDER /* works with: jquery.tweet.js /* Learn to use this at: http://tweet.seaofclouds.com/ /*================================================================*/ $(window).load(function () { $(".tweetslider").tweet({ join_text: "auto", avatar_size: 50, username: "twittertv", // change to your user name count: 10, auto_join_text_default: "", auto_join_text_ed: "", auto_join_text_ing: "", auto_join_text_reply: "", auto_join_text_url: "", filter: function(t){ return ! /^@\w+/.test(t.tweet_raw_text); },//remove replies loading_text: "loading tweets..." }).bind("loaded", function () { $('.tweetslide-wrapper.flexslider').flexslider({ animation: "slide", touch: true, animationLoop: false, smoothHeight: true, controlNav: false, useCSS: false //thins type if true and screws up video }); }); }); /*================================================================*/ /* AUDIO /* works with: audio.min.js /*================================================================*/ audiojs.events.ready(function() { audiojs.createAll(); });