source: trunk/themes/default/js/switchbox.js @ 23384

Last change on this file since 23384 was 23320, checked in by mistic100, 11 years ago

feature:2928 Factorize JS code for switchBox
switchBox("selector for link", "selector for box");

File size: 386 bytes
Line 
1function switchBox(link, box) {
2  jQuery(link).click(function() {
3    var elt = jQuery(box);
4    elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
5      .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true))
6      .toggle();
7  });
8  jQuery(box).on("mouseleave click", function() {
9    jQuery(this).hide();
10  });
11}
Note: See TracBrowser for help on using the repository browser.