1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/piwigo_ynh.git synced 2024-09-03 20:06:03 +02:00
piwigo_ynh/sources/themes/default/js/switchbox.js

23 lines
580 B
JavaScript
Raw Normal View History

2014-07-06 13:21:10 +02:00
(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]);
}
2016-08-27 21:53:29 +02:00
window.SwitchBox = {
2014-07-06 13:21:10 +02:00
push: sbFunc
}
})();