jQuery(document).ready(function(){ // INT // the height of the highest one var highestlanguage = 0; // get highest language so it will not scroll up. var _gethighestlanguage = function () { var _height = jQuery(this).height(); if(highestlanguage<_height) { highestlanguage = _height; } }; // It's not a "real toggle". Just close all and slide down the one var _togglelanguage = function(){ var _target = jQuery(this).data('target'); jQuery(".language").hide(); jQuery("#"+_target).slideDown(); }; // close the nearest element with the class "language". So don't use it in these boxes again var _closelanguage = function () { jQuery(this).closest('.language').slideUp(); }; // Get highest language jQuery(".language").each(_gethighestlanguage); // Assign height to the container. (Prevents page from up-scrolling on close) jQuery(".container").css("min-height", highestlanguage + "px"); // Hide All jQuery(".language").hide(); // Assign functions to the buttons jQuery('.toggle').click(_togglelanguage); jQuery(".close").click(_closelanguage); });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)