Floatbox script don't work in multiple pages

Page: 1

Author Post
jafu
Guest
Hi, I have a image gallery site. When I'm searching for an image I get the results and show all the images founded. On the first page of the results, I click the image and I can see it with Floatbox effect. At this time, that's ok. Now, when I click the link to see the second result page, and the third, and the fourth, etc, when I click whatever image in this page I can't see the effect and the image open in the same window, but just only the image.

What could be happen?

Thanks,
Administrator
Registered: Aug 2008
Posts: 3382
When you say you are showing the images found from a search result, I take this to mean that you are dynamically adding new anchors to a page that has already loaded. If so, you need to run the fb.tagAnchors function against the new content to light-em-up in floatbox. This is detailed here in the docs. Also note that if you need to clear out previously tagged anchors from your collection, call fb.anchors.length=0; just before calling fb.tagAnchors().

Cheers...
jafu
Guest
I use PHP and MySQL. The search program seek from keywords previously entered in the search form, then look for the records in the database and then the program create links like page numbers, depending how many images have match the search criteria. By example, if the database returns 15 records founded, the program create 3 links: page 1, page 2 and page 3. If I click page 1, the floatbox effects appears, but if I click page 2 and page 3 there is no effect. Each page call the same search program and executes the job depending on the parameters. The page 1 execute an SQL statement with limit 0,6, the page 2 execute it again with limit 6,12 and the page 3 with limit 12,15.

Where do I have to put the fb.tagAnchors function and how can I use the fb.anchors.lenght?

I'll appreciate an example,

Thanks for your help.
Administrator
Registered: Aug 2008
Posts: 3382
Ah, so you're not populating the page dynamically? Then never mind about running the tagAnchors function after a dynamic update.

It doesn't matter what the php page is doing on the server side to assemble the page. Floatbox is client-side script and only cares about the html content that is received by the client. If some anchors on your page are opening in floatbox and some are not then it's highly likely there are differences between those anchors. We need to find and fix those problematic differences from the perspective of the html source at the browser end.

If looking for differences at the client end doesn't work it out for you, I could assist if I had access to page that exhibits the problem. Got an online link that I can look at?
jafu
Guest
The site is http://www.latincolorimages.com.
Put some keyword on Busqueda rapida like "navidad", then click "Buscar". You'll see the results of the first page. Click any photo and you'll see the FB effect working well with multiple items (6 photos is the default number for each page). Then, right above o right below in the page, appears the page numbers where you can see more image results. If you click 2, 3, 4 and so, the FB don't work with any photo.
I tried to put the code you recommend me, but it didn't work.

Please help me, I choose FB because it's very good in Windows or Apple browsers, specifically by the function "Save image as..." in both platforms directly on the frame.

Thanks,
« Last edit by Unknown on Sun Mar 29, 2009 8:54 pm. »
Administrator
Registered: Aug 2008
Posts: 3382
Well, that was an interesting problem.

Floatbox can get its options from the querystring on a clicked href. There's a problem in the current version with the way it does that. It's a little too promiscuous in what it takes in. On your page links (1|2|3|etc.) you have a querystring entry named "start". It might look like "start=6" or "start=12". Because of floatbox's mis-handling of querystring options, after it processes that anchor fb.start equals the querystring value (6 or 12 or whatever). The problem with that is, before parsing the querystring fb.start was the function that launches the box! Now it's just a dumb number, so - no more box loading.

The fix for you is to rem out or delete two lines from the floatbox.js file. The two lines are identical. Find the two instances of:
this.setOptions(this.parseOptionString(location.search.substring(1)));

They should be line 121 and line 557.
Hide them or kill them and fb.start should remain the function it needs to be.

PS, Don't forget to pull the following script lines out of your pages. You don't need them and they just throw errors where they are right now.
fb.anchors.length=0;
fb.tagAnchors(document.getElementById('gallery_images'));
fb.loadAnchor('colecciones.html');

Cheers...
jafu
Guest
That's it !!... now my site is showing well all the images!!

Thank you very much!!

Page: 1