/** * jQuery TabbyCat Side * * @author Cafe Faucher & Ashley Stevens -- 2015/10/04 * @link http://cafefaucher/theme/ */ jQuery(document).ready(function($) { // if the url has an id matching a div, open the div. this could be used with a show/hide or to simulate jQuery tabs. jQuery('#toggle-container dt').each(function() { var urlId = window.location.hash.slice(1); if (jQuery(this).attr('id') == urlId) { jQuery(this).addClass('active').next('dd').slideDown('slow','swing'); jQuery('.tabs a[href$="'+urlId+'"]').toggleClass("currentTab"); } }); // toggle open/close the div you click on. this chunk could be used as a simple show/hide on its own. jQuery('#toggle-container dt').click(function() { jQuery(this).toggleClass('active').next("dd").slideToggle('slow','swing'); }); // open only the div you want by clicking on a link. this chunk alone could be used to simulate jQuery Tabs, with some modification. jQuery('#list-links a').click(function() { var linkId = $(this).attr('href').slice(1); jQuery('#toggle-container dt').each(function() { if (jQuery(this).attr('id') == linkId) { jQuery(this).addClass('active').next("dd").slideDown('slow','swing'); jQuery('.tabs a[href$="'+linkId+'"]').addClass("currentTab"); } else if (jQuery(this).next("dd").css('display') == 'block' ) { jQuery(this).removeClass('active').next("dd").slideUp('slow','swing'); jQuery('.tabs a').removeClass("currentTab"); jQuery('.tabs a[href$="'+linkId+'"]').addClass("currentTab"); } }); return false }); // toggle open/close the div you hover on using set widths, with overflow hidden on the containing element. this chunk could be used as a simple show/hide on its own. jQuery('.location').mouseenter(function() { jQuery(this).toggleClass('active').next("div"); jQuery(this).animate({width:"219px"},300); }); jQuery('.location').mouseleave(function() { jQuery(this).toggleClass('active').next("div"); jQuery(this).animate({width:"105px"},300); }); });