fb.start modify open and close position

Page: 1

Author Post
Member
Registered: Mar 2014
Posts: 5
I have an entry level with javascript, but i have been trying FLOATBOX, and i get it works.
Now i am stuck, with fb.start. i have it working with 2 popups, but i can't make them close where i want, in the example i created, as soon as the page load fb.start open the popup windows always from the center, and close to the center.
How can i assign fb.start the place from where i want to open and close the popup windows?
You can see the example here:

http://elduran.sytes.net/samplefb

Thanks in advance
Administrator
Registered: Aug 2008
Posts: 3382
There are startAt and endAt options provided to do exactly this. Here's what the Options Reference has to say about them:
Quote
startAt - id | null
The default starting point for opening box animations is either at the click or touch location or from a thumbnail if the 'zoom' effect is being used. Set startAt to an id of an element on the page to start the animations from the center of that element. Set startAt to null to make the starting point the center of the screen.

endAt - 'start' | id | null
The endAt option controls the ending point that a floatbox will collapse to when animating out. If zooming from an image down to a thumbnail, the default closing point will be the thumbnail that matches the currently showing image. If not zooming to a thumbnail, the default closing location is at the mouse click or touch that opened the box. If neither of the above, it will go to the center of the screen.
Set endAt to an element's id to set the closing point to the center of that element. This could be useful for example when closing a shopping cart form and wanting to draw attention towards an updated cart link on the page. Set endAt to null to close to the center of the screen, and set it to 'start' to have it close to wherever it started from (which is usually the default behaviour anyway).
Member
Registered: Mar 2014
Posts: 5
Thanks for your answer, it works
Now, my question is, after close, i noticed, i can't open it again from the element i set to start, and i would like to have the option to open it again, in case the user need it without refresh

the link is

http://elduran.sytes.net/samplefb


Thanks
Administrator
Registered: Aug 2008
Posts: 3382
Sorry, I don't understand. If you want a floatbox to open when clicking an element, just set up a standard floatboxed link around that element. This is the basic operational mode of Floatbox. I also don't know what it is you are trying to show me with those two floatboxes that autoStart on page load on your linked page.
Member
Registered: Mar 2014
Posts: 5
Thanks for your answer
What i am trying to do is to open the popup windows when page load using fb.start from the element i select using startAt, it is solved.
But if i setup the standard floatbox link, on the element and the user click on it without close the popup window, it will open the popup window again because it is outside the fb.DOMReady script, and that will give me the same popup window twice, is there any way to avoid that?, maybe if i setup the floatbox link on the fb.start ?, if yes how can i do that.

Thanks
Administrator
Registered: Aug 2008
Posts: 3382
I'm still confused, but that happens easily.

I think there's some overlap in this thread about starting in the sense of the document coordinates where the animated enlargement originates from and starting in the sense of firing up a floatbox from a click or autoStart action. Two entirely different things.

Regardless, it raises my eyebrows when I see you refer to starting something in an fb.DOMReady function. That's not a great way to do it.

Just have one link on your page for the content you want to show in a Floatbox. If you want that content to be shown at page start, as if a user clicked the link right away, just put "autoStart:true" in its options. If a user clicks a link again when a corresponding floatbox is already open, nothing will happen.

I think the problem is you've set up two items, one in a link on your page, and one with an fb.start command fired from fb.DOMReady. I don't think you want two items. Just use the one link and put "autoStart:true" on it if you want it to auto-start.
Member
Registered: Mar 2014
Posts: 5
I know it's a little confuse, i'm sorry, i am not explaining well.
"autostart:true" only works for 1 popup window, and i want to autostart 4 popup windows, that's why i am using fb.start, and i have to keep the link for the content out of the fb.DOMReady function in case the user close the popup window, and want to open it again, and you are right i don't want two items.

Thanks
Administrator
Registered: Aug 2008
Posts: 3382
Just have the one link on the page, and load that with fb.start(), instead of creating a new duplicate item at page start.

Put an id on the link, something like id="theId". Then start that link by referencing its id. fb.start( "theId" ). Now its the actual linked item that's showing and it can't be duplicated by clicking on the link while it's already showing.
Member
Registered: Mar 2014
Posts: 5
Thanks for your help, now it works like i want.

Page: 1