问题
I'm working with fancybox 2.0.5. I have it opening to a size of 450 x 500. The content of it is a long terms of use agreement. The user must click the accept button at the bottom. We'd like to be able to have it stuck to the bottom of the fancybox popup so that it is "static" regardless of the scrolling. I am trying to use the below to no avail. I can't make .fancybox-inner respond to anything. Suggestions?
$(".fancybox-inner").append("<input id='accept' type='button' value='Accept'>");
回答1:
Since the div thats rendering the fancybox doesn't have any content until you load fancybox, you need to trigger your code after the fancybox has loaded:
$(".fancybox").fancybox({
onComplete: function(){
$(".fancybox-inner").append("");
}
});
Alternatively, you could tell fancybox itself not to scroll and set an overflow:auto container div inside your content, and add the (agree) button after
来源:https://stackoverflow.com/questions/9639016/jquery-fancybox-append-to-fancybox-inner