I have a newsletter signup form in the footer of my website. In the sidebar I have a link which triggers a fancybox window using the signup form's div as its content.
As expected, this causes the form to dissappear from the footer and pop up in the lightbox.
I close the lightbox and it goes back to how it was. With one extremely annoying exception: It is wrapped in an additional div
. The more times I open and close the lightbox window, the more div
s it accumulates.
Now, I generally would just have the fancybox grab content from a hidden div (a second copy of the form), but its generated by a plugin in WordPress (mailchimp), and I can't change the #id or form name.
So this is either a bug or a feature of fancybox. I'm 99.9% sure its not me doing something "wrong". Anybody have a way I can remove the wrapped divs? I guesse I can try to put some jquery snippet in onClosed
which removes a div from #email_signup... but I'll probably wait until tomorrow to do that.
The relevant code:
js
jQuery("#signMeUpBox a").fancybox({width:250});
html
<a href="#email_signup"><img src="...." /></a>
heres the footer code after a couple fancybox open/closes:
<div style="width:auto;height:auto;overflow: auto;position:relative;">
<div style="width:auto;height:auto;overflow: auto;position:relative;">
<div id="email_signup" style="">
<h1 style="">email signup</h1>
<div id="mc_signup" style="">
<form method="post" action="#mc_signup" id="mc_signup_form" style="">
<!-- ... -->
</form><!-- /mc_signup_form -->
</div><!-- /mc_signup_container -->
</div>
</div>
</div>
EDIT
I put together a jsfiddle to illustrate the situation. http://jsfiddle.net/UD9P9/