diff options
Diffstat (limited to 'themes/default/js/switchbox.js')
-rw-r--r-- | themes/default/js/switchbox.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/themes/default/js/switchbox.js b/themes/default/js/switchbox.js new file mode 100644 index 000000000..b20f82d50 --- /dev/null +++ b/themes/default/js/switchbox.js @@ -0,0 +1,23 @@ +(function () { + var sbFunc = function(link, box) { + jQuery(link).click(function() { + var elt = jQuery(box); + elt.css("left", Math.min( jQuery(this).position().left, jQuery(window).width() - elt.outerWidth(true) - 5)) + .css("top", jQuery(this).position().top + jQuery(this).outerHeight(true)) + .toggle(); + return false; + }); + jQuery(box).on("mouseleave click", function() { + jQuery(this).hide(); + }); + }; + + if (window.SwitchBox) { + for (var i=0; i<SwitchBox.length; i+=2) + sbFunc(SwitchBox[i], SwitchBox[i+1]); + } + + SwitchBox = { + push: sbFunc + } +})();
\ No newline at end of file |