clonePosition not working with newly created DOM element?

6 views
Skip to first unread message

Paul R.

unread,
Nov 30, 2007, 4:08:57 PM11/30/07
to Ruby on Rails: Spinoffs
Hey folks,
I'm hoping that someone on this group can give me some advice.
I'm currently trying to solve the IE hover issue where if you have a
hover div that appears over a
form element, it pops through. The best solution I've found is to shim
in an <iframe> under my hover
for IE browsers and it will block the form element. (I surmise that
most people in this group are familiar with
this fix). I'm trying to use clonePosition to match the location and
size of my hover for my iframe only it's not working.
It will apply the size to my iframe, but not the location attributes.
I am creating this iframe on the fly with the Element function. Is the
issue that I am creating the iframe incorrectly? Is it my usage of
clonePosition?
I'm using the latest prototype and scriptaculous framework. If anyone
has an idea of what I'm doing wrong that'd be
great, or if there is something out there that someone could point me
to that'd rock too.
Much thanks in advance to anyone with some advice.

-Paul

<code>
function ieShimFix(elmnt){
var body = document.getElementsByTagName("body")[0];
var ieFixframe = new Element('iframe',
{id:'ieFixframe',className:'ieFix',zIndex:'50'});
$(body).appendChild(ieFixframe);
Element.clonePosition(ieFixframe,elmnt);
$('ieFixframe').style.display = "block";


}
</code>

kangax

unread,
Nov 30, 2007, 5:28:46 PM11/30/07
to Ruby on Rails: Spinoffs
Did you assign absolute position to the iframe?
It also makes sense to hide it and set proper src attribute:

http://dev.prototype-ui.com/browser/trunk/src/util/iframe_shim.js#L41
http://dev.rubyonrails.org/browser/spinoffs/scriptaculous/src/controls.js#L97
Reply all
Reply to author
Forward
0 new messages