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).position().left, jQuery(window).width() - elt.outerWidth(true) - 5)) |
---|
6 | .css("top", jQuery(this).position().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 | window.SwitchBox = { |
---|
21 | push: sbFunc |
---|
22 | } |
---|
23 | })(); |
---|
Note: See
TracBrowser
for help on using the repository browser.