aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/js/switchbox.js
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-06-18 10:29:55 +0000
committermistic100 <mistic@piwigo.org>2013-06-18 10:29:55 +0000
commit078e4d1bbdc920ff6c7a3ba8777fae2b23d38909 (patch)
treeb16cf52fa2642b8118985173b9723e5d4655907f /themes/default/js/switchbox.js
parent9602a3a2034ac6a83a90a9fb925065a931a2ff19 (diff)
feature:2928 Factorize JS code for switchBox
switchBox("selector for link", "selector for box"); git-svn-id: http://piwigo.org/svn/trunk@23320 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--themes/default/js/switchbox.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/themes/default/js/switchbox.js b/themes/default/js/switchbox.js
new file mode 100644
index 000000000..9e8167a33
--- /dev/null
+++ b/themes/default/js/switchbox.js
@@ -0,0 +1,11 @@
+function switchBox(link, box) {
+ jQuery(link).click(function() {
+ var elt = jQuery(box);
+ elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
+ .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true))
+ .toggle();
+ });
+ jQuery(box).on("mouseleave click", function() {
+ jQuery(this).hide();
+ });
+} \ No newline at end of file