我有一个页面,它使用 jQuery.swfobject 插件将 5 个 Flash 项目嵌入到页面中,每个 Flash 项目都有一个使用 externalInterface 的回调。当我在 $(document).ready(function() 之外使用 js 函数但 jQuery 动画不会触发时,回调会起作用 - 但 ajax 加载会触发。
有谁知道如何让动画也正常工作,代码如下:
function pageLoader(galID) {
$('#menu').hide();
$('#holder_gallery').load("feeds.php", {gallery: galID}, function(){
$('#holder_gallery ul li a').slimbox();
$('#holder_gallery').jScrollPane();
$('.galleryTitle').text(galleryTitle);
$('.galleryTitle').fadeIn(2000);
$('#holder_gallery').fadeIn(2000);
$('.ghost').each(function() {
$(this).hover(function() {
$(this).stop().animate({ opacity: 1.0 }, 300);
},
function() {
$(this).stop().animate({ opacity: 0.5 }, 300);
});
});});}
上面的主要部分工作得很好 - 我只想使用 fadeIn 函数和悬停动画来添加光泽。 jScrollpane 与 .load 一样恢复自身
问候,
MM
最佳答案
在 #holder_gallery
动画的回调中绑定(bind) .ghost
元素怎么样
//existing code
$('#holder_gallery').fadeIn(2000, function(){
$('.ghost', this).each(function() {
$(this).hover(function() {
$(this).stop().animate({ opacity: 1.0 }, 300);
},
function() {
$(this).stop().animate({ opacity: 0.5 }, 300);
});
});
});
关于javascript - Flash 回调后恢复 Jquery 功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1937359/