Reputation: 89
my jQuery Code
$("#div1").load("test1.html")
$("a#link").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'width' : 400,
'height' : 200,
'overlayOpacity': 0.5,
'type' : 'iframe'
});
After .load
my fancybox doesn't work.
It work in test1.html
.
How am i suppose to write it?
Upvotes: 0
Views: 236
Reputation: 3570
I don't know anything about fancybox but when using the load function the data is loaded asynchronously so anything after the call to load could be done before it is loaded. you should add the code into the callback if you want it to effect the items you have loaded in.
$("#div1").load("test1.html", function () {
$("a#link").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'width' : 400,
'height' : 200,
'overlayOpacity': 0.5,
'type' : 'iframe'
});
})
Upvotes: 2
Reputation: 2579
You might just need to add a ;
semi-colon to the end of that line?
$("#div1").load("test1.html");
The syntax is wrong... are you getting any errors?
You also may want to consider binding this to a live()
event.
Otherwise the content from test1.html isn't going to be included.
See this post here:
Fancybox, getting Fancybox to bind using LIVE() to items being loaded onto the page after load
Upvotes: 0