html that was in FancyBox gets added to directly to <body> after fancybox closes

34 views
Skip to first unread message

Bytor99999

unread,
May 21, 2012, 4:48:17 PM5/21/12
to fancybox
This happens either by submitting or hitting the cancel X.

I am also using ICanHaz.js templating engine. I basically call iCanHaz
to generate a form for me that I add the html to fancybox. When I
close the fancybox box that form html is now added to the <body> tag
of my document. And keeps adding it after each close of a fancybox.

Basically I have a page with a button. Click the edit button, call
ICanHaz to generate the form. then call fancybox

function showOverlayToEditEvent(data) {
var contents = ich['eventEntry'](data);
$.fancybox( contents, {
maxWidth : 480,
fitToView : true,
autoSize : true,
openEffect : 'fade2',
closeEffect : 'fade'});
}

If I hit the X on fancybox overlay. The form that was in the overlay
is now in the body of my document. Not showing, but in the <body>

I click the edit button the overlay shows again, close it with the X
and now I have that form twice in my <body>

If I keep repeating then I get many more forms added to my body.

I have another form that isn't using ICanHaz that is a static form in
a hidden div. I call fancybox, then click the X and that form also
appears in my body of my document. But it never duplicates. I can open
the form over and over and it only shows up once.

I know ICanHaz doesn't add stuff to the document. Just has a function
that takes JSON and returns a String of html, and I choose where or if
I put it anywhere.

Thanks

Mark

Bytor99999

unread,
May 21, 2012, 4:56:23 PM5/21/12
to fancybox
OK, found that I am not the only one this happened to.

Found this workaround in another thread
http://groups.google.com/group/fancybox/browse_thread/thread/fab7b6d81a173b33/

Thanks

Mark

Bytor99999

unread,
May 21, 2012, 5:14:56 PM5/21/12
to fancybox
Just have to figure out where I can put that code to get that to work.

Mark

On May 21, 1:56 pm, Bytor99999 <bytor99...@gmail.com> wrote:
> OK, found that I am not the only one this happened to.
>
> Found this workaround in another threadhttp://groups.google.com/group/fancybox/browse_thread/thread/fab7b6d8...

Bytor99999

unread,
May 21, 2012, 5:22:01 PM5/21/12
to fancybox
I added another workaround to the Issue #95

But here it is

I found this works.

var contents = someHtml;
$.fancybox({
content: contents,
…..
});
instead of using

$.fancybox(contents, {…});

Thanks

Mark

On May 21, 1:56 pm, Bytor99999 <bytor99...@gmail.com> wrote:
> OK, found that I am not the only one this happened to.
>
> Found this workaround in another threadhttp://groups.google.com/group/fancybox/browse_thread/thread/fab7b6d8...
Reply all
Reply to author
Forward
0 new messages