close floatbox

Page: 1

Author Post
frank1o05
Guest
The question has been asked and answered once, I know, but let me try again with a twist.

Is there a way to make the floating box close by clicking ANYWHERE, i.e. in particular on the image displayed in the box? I am willing to give up all other functionality. All I would like to do is use floatbox as something like a magnifier on a page with image thumbnails. No nagivation at all required. I just want the user to be able to click on a thumbnail, see the enlarged image in the floatbox, and get back to the thumbnails with the smallest effort possible. I realize that this is like using a Ferrari exclusively for going to the Post office. Thanks for any hint (including alternatives to floatbox for this sort of thing).
gregp
Guest
Firstly, turn off auto sizing and resizing of images. At the top of floatbox.js:


autoSizeImages: false ,// true|false
autoSizeOther: false ,// true|false
resizeImages: false ,// true|false
resizeOther: false ,// true|false


This will stop the resizing behaviours when you click on the image which frees the click behavior up for other functionality.

Then, around line 761 in floatbox.js, find:

this.fbClose.onclick = function() {


and replace with

this.fbClose.onclick = this.fbMainDiv.onclick =  this.fbCanvas.onclick = function() {


I'm not sure what part of the tool each of those additional objects actually refer to, I just went by the names, but it worked for me with both or either so it's probably safest to use both. I'm sure there's a better or more accurate way to do this which no doubt admin will let us know about but it worked for me.

Greg
« Last edit by Unknown on Wed Mar 04, 2009 11:19 pm. »
frank1o05
Guest
Thanks very much, Greg.

Page: 1