From a4c482d983572b2fde3d4e3d608a214ce2b60d3c Mon Sep 17 00:00:00 2001 From: Christian Stoller Date: Mon, 12 Nov 2012 12:55:43 +0100 Subject: [PATCH] Facebox - added Autoscroll feature --- src/facebox.css | 3 +-- src/facebox.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/facebox.css b/src/facebox.css index 3f33b9f..433d312 100644 --- a/src/facebox.css +++ b/src/facebox.css @@ -19,7 +19,6 @@ } #facebox .content { - display:table; width: 370px; padding: 10px; background: #fff; @@ -38,7 +37,7 @@ #facebox .close{ position:absolute; top:5px; - right:5px; + right:17px; padding:2px; background:#fff; } diff --git a/src/facebox.js b/src/facebox.js index 392adf8..2919dbf 100644 --- a/src/facebox.js +++ b/src/facebox.js @@ -84,6 +84,7 @@ settings: { opacity : 0.2, overlay : true, + autoscroll : true, loadingImage : '/facebox/loading.gif', closeImage : '/facebox/closelabel.png', imageTypes : [ 'png', 'jpg', 'jpeg', 'gif' ], @@ -102,8 +103,14 @@ if ($('#facebox .loading').length == 1) return true showOverlay() - $('#facebox .content').empty(). - append('
') + var content = $('#facebox .content') + content.empty().append('
') + if ($.facebox.settings.autoscroll) { + content.css({ + height: getPageHeight() - ((getPageHeight() / 10) * 2), + overflowY: 'auto' + }) + } $('#facebox').show().css({ top: getPageScroll()[1] + (getPageHeight() / 10),