attachTo not working

Page: 1

Author Post
Member
Registered: Dec 2012
Posts: 3
Hi All,

I am opening a floatbox on top of a context box. The boxes are displayed correctly except that the 'floatbox' is not attachTo the 'div' that I mentioned in the options any Idea ?

Following is the code sample

<a class="settings fbContext" data-fb-context="source:#moreactions attachToHost:true placement:bottom" href="">Actions</a>

<div id="moreactions" class="action" style="display:none; margin:10px !important; width:200px !important;">
<a class="voice floatbox" href="#divTellFriends" data-fb-options="beforeBoxStart:`closeFd();` innerBorder:0 attachTo:the_body showOuterClose:true showClose:false scrolling:no">Tell a friend</a>

</div>



So basically the 'divTellFriends' box is not attach to the 'the_body' div
Member
Registered: Dec 2012
Posts: 3
I find a 'work around' or may it the way to do it but If I put the same option 'attachTo:the_body' on the context box as well then it is working.
Administrator
Registered: Aug 2008
Posts: 3382
Sorry, I don't understand what you are getting at at all. Can you link me into a page that illustrates the problem and tell me what to look for on that page?
Member
Registered: Dec 2012
Posts: 3
Hi.

yes it is not clear

1- go to the following location : http://www.focusdepart.com/pictures/picture/

2- click on 'Actions' (on top of the picture) it will display a context box with the list of actions.

3- click on the action 'Tell a friend' which open a floatbox. On this box I set a data-fb-options 'attachTo:blabla' but it is ignored it doesn't work.

To get it working I have to set the same option 'attachTo:blabla' on the data-fb-context of the context box.


Hope it helps
Administrator
Registered: Aug 2008
Posts: 3382
Thanks for the link.

You have "attachTo:itemForm" in the options and the floatbox elements are indeed attaching to the document as children of this form. When you say it's not working, I think you must expect that option to do something other than what it does.

The attachTo option does not position a floatbox on the screen. It inserts the floatbox component into the requested element in the document node heirarchy. There are only two reasons why you would want to do this.

The first is to enhance accessibility for people who can't see your site and use a screen reader to access it. Placing the floatbox at a certain location in the document hierarchy means it will be read or recited by the screen reader in the correct sequence relative to the rest of the document. Correct sequencing of content is a requirement of the US Government's Section 508 accessibility requirements. Floatbox is the only such effects library that can be used to build Section 508 compliant web sites thanks to attachTo and a few other correct accessibility-enhancing behaviours.

The second purpose is that you may have form elements within the floatbox that you want to have submitted along with a form defined on the main page. This can easily be the case in ASP.NET pages which can have only one form: i.e., the built-in one that wraps the entire page.

Again: the attachTo option has nothing to do with positioning the floatbox on the screen. Maybe you're looking for the boxLeft and boxTop options? Check the Options Reference.

Here's a partial view of your page's DOM as seen by Firebug when the floatbox is open. All the floatbox elements are within the "fbx" div and, as you can see, that div is attached as a child of the "itemForm" form element as requested.
<body>
<form id="itemForm" class="itemForm" accept-charset="utf-8" method="post" name="itemForm" action="">
<div style="display:none;">
<div id="header">
<input id="isAjaxSubmit" type="hidden" value="" name="isAjaxSubmit">
<div id="the_body">
<div id="footer">
<div id="current_trip">
<div style="display:none;">
<div id="fbx" class="fbx">
<div id="fbCaliper_1" class="fbx fbCaliper fbCaliper_white" style="transition-duration: 0s; -moz-box-sizing: content-box; position: absolute; top: -99999px; padding: 0px; margin: 0px; border-width: 0px; overflow: hidden; visibility: hidden; display: none;"></div>
</form>

Page: 1