Weird Error (possibly timing issue)? AND a question

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Weird Error (possibly timing issue)? AND a question

       
In my main HTML page, I load all the JS libraries. Then, in the onClick of button I have the following code (PhotoAlbum is a SmartClient object that holds the thumbnail images):


                                           PhotoAlbum.show();
//                                        document.observe('dom:loaded', function () {
                                            Shadowbox.init({
                                                skipSetup: false,
                                                onOpen: function(currentElement) {
                                                    console.warn("ShadowBox Loaded");
                                                    PhotoAlbum.hide();
                                                },
                                                onClose: function(currentElement) {
                                                    PhotoAlbum.show();
                                                },
                                                gallery:   'My pictures',
                                                continuous: true,
                                                overlayColor: '#FFFFFF',
                                                overlayOpacity: 1.0,
                                                keysClose: ['c', 27],
                                                displayNav: true
                                            });
                                            //debugger;
                                            alert("sleeeeep");
                                           
                                            Shadowbox.setup($$('a.picture'), {
                                            })


Here's my 2 problems
1) Somehow, unless I have a debugger (FF) or an alert between the init and setup, I get the following JS error:
[Break on this error] element.attachEvent("on" + name, wrapper);
If I put a debugger and let it "run" it works fine.

2) The next/previous/close links are not clickable somehow. I can do use keys to navigate or close the shadowbox, but the links themselves do not work.

Also, I had a question:
Is there a way for the user to "select" a particular image from the album/gallery? If they like an image, they should be able to add to their cart. So I was wondering if I can somehow provide a select-able functionality to the images?

thanks a lot.

jay2007
I started looking at Shadowbox this morning and am quite happy with the way it works (after having struggled all weekend with Lightbox). Here's what I have:

I am trying to load a series of images (gallery) that is generated from a Rails page. My interface is actually a AJAX set of libraries (SmartClient). When a user clicks on "Show Image", currently I load a SmartClient object (modal window) that pulls the set of image thumbnails from the Rails page and display them. These thumbnails all have the following format:

   
<a class='picture' rel='shadowbox[pictures]' href="/smartclient/images/Image1.jpg"><img width="200" height="200" src="/smartclient/images/Image1.jpg"/></a><a class='picture' rel='shadowbox[pictures]' href="/smartclient/images/Image2.jpg"><img width="200" height="200" src="/smartclient/images/Image2.jpg"/></a>