+
{'Photo sizes'|@translate}
{foreach from=$image_derivatives item=image_derivative name=loop}{if !$smarty.foreach.loop.first}
{/if}
{if $image_derivative.SELECTED}
@@ -48,17 +57,26 @@ function toggleSortOrderBox(forceHide) {
{/foreach}
{footer_script}{literal}
-function toggleImageDerivativesBox(forceHide) {
- var elt = document.getElementById("derivativeSwitchBox"),
- ePos = document.getElementById("derivativeChooseLink");
- if (!forceHide && elt.style.display==="none") {
- elt.style.left = (ePos.offsetLeft-25)+"px";
- elt.style.top = (ePos.offsetTop+ePos.offsetHeight)+"px";
- elt.style.display="";
- }
- else
- elt.style.display="none";
-}
+$(document).ready(function() {
+ $("#derivativeSwitchBox").css({'top':0,'left':0});
+ var derivativeSwitchBox_width = $("#derivativeSwitchBox").outerWidth(true);
+ var derivativeSwitchBox_height = $("#derivativeSwitchBox").outerHeight(true);
+
+ $("#derivativeSwitchLink").click(function() {
+ $("#derivativeSwitchBox").toggle();
+
+ if ($(this).offset().left + derivativeSwitchBox_width > $(window).width()) {
+ $("#derivativeSwitchBox").css("left", $(window).width() - derivativeSwitchBox_width - 5);
+ } else {
+ $("#derivativeSwitchBox").css("left", $(this).offset().left);
+ }
+ $("#derivativeSwitchBox").css("top", $(this).offset().top + $(this).outerHeight(true));
+ });
+
+ $("#derivativeSwitchBox").bind("mouseleave", function() {
+ $(this).hide();
+ });
+});
{/literal}{/footer_script}
{/strip}
{/if}
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index 9dc75d741d..c0f44ffa49 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -35,40 +35,44 @@ function changeImgSrc(url,typeSave,typeMap)
document.cookie = 'picture_deriv='+typeSave+';path={/literal}{$COOKIE_PATH}{literal}';
}
-function toggleDerivativeSwitchBox()
-{
- var elt = document.getElementById("derivativeSwitchBox"),
- ePos = document.getElementById("derivativeSwitchLink");
- if (elt.style.display==="none")
- {
- elt.style.left = (ePos.offsetLeft)+"px";
- elt.style.top = (ePos.offsetTop+ePos.offsetHeight)+"px";
- elt.style.display="";
- }
- else
- elt.style.display="none";
-}
-jQuery("#derivativeSwitchBox").on('mouseleave click', function() {
- this.style.display="none";
-}
-);
+$(document).ready(function() {
+ $("#derivativeSwitchBox").css({'top':0,'left':0});
+ var derivativeSwitchBox_width = $("#derivativeSwitchBox").outerWidth(true);
+ var derivativeSwitchBox_height = $("#derivativeSwitchBox").outerHeight(true);
+
+ $("#derivativeSwitchLink").click(function() {
+ $("#derivativeSwitchBox").toggle();
+
+ if ($(this).offset().left + derivativeSwitchBox_width > $(window).width()) {
+ $("#derivativeSwitchBox").css("left", $(window).width() - derivativeSwitchBox_width - 5);
+ } else {
+ $("#derivativeSwitchBox").css("left", $(this).offset().left);
+ }
+ $("#derivativeSwitchBox").css("top", $(this).offset().top + $(this).outerHeight(true));
+ });
+
+ $("#derivativeSwitchBox").bind("mouseleave click", function() {
+ $(this).hide();
+ });
+});
{/literal}{/footer_script}
-{strip}
- {'Photo sizes'|@translate}
+{strip}
+ {'Photo sizes'|@translate}
+
-{/strip}{/if}
-
+{/strip}
+{/if}
{strip}{if isset($U_SLIDESHOW_START)}