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

Last change on this file since 23437 was 23437, checked in by rvelices, 11 years ago

feature 2928: fctorize switchBox (now js is loaded async + also apply to the calendar type links on index page)

File size: 569 bytes
Line 
1(function () {
2        var sbFunc = function(link, box) {
3                jQuery(link).click(function() {
4                        var elt = jQuery(box);
5                        elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
6                                .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true))
7                                .toggle();
8                        return false;
9                });
10                jQuery(box).on("mouseleave click", function() {
11                        jQuery(this).hide();
12                });
13        };
14
15        if (window.SwitchBox) {
16                for (var i=0; i<SwitchBox.length; i+=2)
17                        sbFunc(SwitchBox[i], SwitchBox[i+1]);
18        }
19
20        SwitchBox = {
21                push: sbFunc
22        }
23})();
Note: See TracBrowser for help on using the repository browser.