- Create Account

Lightbox compatibility

Forums > SuperNote > Lightbox compatibility
Author
Message

1) reimagine Group: Members
Posts: 1 Joined: 11 Sep 2007 Location: IP: 71.111.--.--
I am trying to use Supernote on the same page I'm using Lightbox. All works fine on Firefox (PC and Mac) and Safari (Mac), but in IE when I click on the thumbnail (a link within a Supernote box) it opens the image in a new window rather than over the current window with the "lightbox" effect.

If I remove Supernote, then the Lightbox effect works. Any ideas?

Thanks!

2) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
They'll both be trapping the document.onclick event I guess... which lightbox script is this with, and do you have a link to the site in question?

- Angus.

3) Downgang Group: Guests
IP: 85.140.--.--
Yes, i have the same problem. Reimagine had in view Lokesh Dhakar's script - http://www.huddletogether.com. I'm disturbed: Lightbox and Supernote are both excellent scripts. Why I have to choose between of them?! I'll try to fix the problem, but it seems hopelessly.

4) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
That script uses Prototype v1.4 which extends the global Object.prototype with its own methods. This is bad behaviour that will affect every script on the page and I don't intend to patch SuperNote to avoid it!

Prototype v1.5 has wisely abandoned this approach and should be fully compatible with this script. Try dropping in v1.5 and seeing if the lightbox still works. If it doesn't, please suggest to the lightbox script author that s/he upgrade the script to Prototype v1.5.

Good luck - Angus.

5) bangers Group: Guests
IP: 79.77.--.--
I'm just trying supernote out at the moment and came across this problem when I added supernote to a template using lightbox.
I updated to Prototype.js v1.5 (also tried 1.6) but problem still continues.
Has there been any further update on this problem?
I'm sure there are a growing band of sites which rely on Lightbox but would like to add supernote to there site.

6) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 202.137.--.--
OK, I have solved this. The problem is that the other script is using older DOM event cancelling techniques ("return false") and the SuperNote script's document-level event capturing function renders that ineffective. To fix, in lightbox.js change this line in the updateImageList function:

anchor.onclick = function  () {myLightbox.start(this); return false;}

to this:

anchor.onclick = function  (evt) {myLightbox.start(this); evt = evt || window.event; evt.returnValue = false; if (evt.preventDefault) evt.preventDefault(); }

You  might want to feed this back to the original author as it'll enhance Lightbox's compatibility with many other scripts too. I don't use Prototype a lot myself but I understand that it has some event management functions in its library that might help here if utilised!

Good luck - Angus.

7) bangers Group: Members
Posts: 6 Joined: 9 Dec 2007 Location: uk IP: 79.77.--.--
Thanks Angus, just tried it out and it works perfectly.
I'll do a little more tinkering but I should think I will start using Supernote so with donate soon.
Cheers Lee

p.s Email address of original thread author is not viewable so I can't sent email

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.