Jquery innerfade内部ajaxed内容

Jquery innerfade内部ajaxed内容,jquery,ajax,load,Jquery,Ajax,Load,我试图在jquery.load函数加载的内容中加载jquery innerfade函数,我看到了许多类似的主题,但由于我对javascript非常陌生,因此无法获得正确的解决方案 这是我用来加载内容的脚本: $(document).ready(function() { // Check for hash value in URL var hash = window.location.hash.substr(1); var href = $('.nav li a').each(fun

我试图在jquery.load函数加载的内容中加载jquery innerfade函数,我看到了许多类似的主题,但由于我对javascript非常陌生,因此无法获得正确的解决方案

这是我用来加载内容的脚本:

$(document).ready(function() {  

// Check for hash value in URL  
var hash = window.location.hash.substr(1);  
var href = $('.nav li a').each(function(){  

    var href = $(this).attr('href');  
    if(hash==href.substr(0,href.length-5)){  
        var toLoad = hash+'.php #content';  
        $('#content').load(toLoad)
    }  
});  

$('.nav li a').click(function(){  

var toLoad = $(this).attr('href')+' #content';  
$('#content').hide('fast',loadContent);  


$('#load').remove();  
$('#sub_corpo').append('<span id="load">sto caricando il contenuto...</span>');  
$('#load').fadeIn('normal');  
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);  



function loadContent() {  
    $('#content').load(toLoad,'',showNewContent())  

}  
function showNewContent() {  
    $('#content').show('normal',hideLoader());  


}  
function hideLoader() {  
    $('#load').fadeOut('normal');  
}  
return false;  

});  
$(文档).ready(函数(){
//检查URL中的哈希值
var hash=window.location.hash.substr(1);
var href=$('.nav li a')。每个(函数(){
var href=$(this.attr('href');
如果(hash==href.substr(0,href.length-5)){
var toLoad=hash+'.php#content';
$(“#内容”).load(toLoad)
}  
});  
$('.nav li a')。单击(函数(){
var toLoad=$(this.attr('href')+'#content';
$('content').hide('fast',loadContent);
$(“#加载”).remove();
$('sub#corpo')。追加('sto caricando il contenuto…');
$('加载').fadeIn('正常');
window.location.hash=$(this.attr('href').substr(0,$(this.attr('href').length-5);
函数loadContent(){
$('#content').load(toLoad',showNewContent())
}  
函数showNewContent(){
$('#content').show('normal',hideLoader());
}  
函数hideLoader(){
$('加载').fadeOut('正常');
}  
返回false;
});  
}))

这是innerfade函数:

<script >
function(){

$('#slideshow').innerfade({
        speed: 4500,
        timeout: 6000,
        type: 'sequence',
        containerheight: '480px'
        });
}
</script>

函数(){
$(“#幻灯片放映”).innerfade({
速度:4500,
超时:6000,
类型:'序列',
集装箱重量:“480px”
});
}
我不知道在加载内容时如何调用此函数。我真的很感激你的建议


Dimtiri

这应该是答案:

$('#content').load(toLoad, function() {
  $('#slideshow').innerfade({
        speed: 4500,
        timeout: 6000,
        type: 'sequence',
        containerheight: '480px'
        });
});

谢谢你的建议,我已经测试过了,但似乎不起作用。 这是新的最终jquery代码:

$(document).ready(function() {  

// Check for hash value in URL  
var hash = window.location.hash.substr(1);  
var href = $('.nav li a').each(function(){  

    var href = $(this).attr('href');  
    if(hash==href.substr(0,href.length-5)){  
        var toLoad = hash+'.php #content';  
        $('#content').load(toLoad, function() {
        $('#slideshow').innerfade({
        speed: 4500,
        timeout: 6000,
        type: 'sequence',
        containerheight: '480px'
        });
        });
    }  
});  

$('.nav li a').click(function(){  

var toLoad = $(this).attr('href')+' #content';  
$('#content').hide('fast',loadContent);  


$('#load').remove();  
$('#sub_corpo').append('<span id="load">sto caricando il contenuto...</span>');  
$('#load').fadeIn('normal');  
window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);  



function loadContent() {  
    $('#content').load(toLoad,'',showNewContent())  

}  
function showNewContent() {  
    $('#content').show('normal',hideLoader());  


}  
function hideLoader() {  
    $('#load').fadeOut('normal');  
}  
return false;  

});  

});
$(文档).ready(函数(){
//检查URL中的哈希值
var hash=window.location.hash.substr(1);
var href=$('.nav li a')。每个(函数(){
var href=$(this.attr('href');
如果(hash==href.substr(0,href.length-5)){
var toLoad=hash+'.php#content';
$('#content').load(toLoad,function(){
$(“#幻灯片放映”).innerfade({
速度:4500,
超时:6000,
类型:'序列',
集装箱重量:“480px”
});
});
}  
});  
$('.nav li a')。单击(函数(){
var toLoad=$(this.attr('href')+'#content';
$('content').hide('fast',loadContent);
$(“#加载”).remove();
$('sub#corpo')。追加('sto caricando il contenuto…');
$('加载').fadeIn('正常');
window.location.hash=$(this.attr('href').substr(0,$(this.attr('href').length-5);
函数loadContent(){
$('#content').load(toLoad',showNewContent())
}  
函数showNewContent(){
$('#content').show('normal',hideLoader());
}  
函数hideLoader(){
$('加载').fadeOut('正常');
}  
返回false;
});  
});
为了提供更多信息,以下是应该通过jquery加载到“content”div中的页面代码:


西番莲

我在阿彭尼诺-坎帕诺的蒙托索山。我在莫佛洛吉科和埃格拉夫的土地上发现了皮森蒂尼;rimasto immutato nel tempo,così;来吧,蒂皮希特和阿格拉夫;美食学,达拉斯诺奇奥拉·托达·吉福尼·奥特努托·科林·萨勒尼坦大酒店,达拉斯奥里瓦·罗通代拉大酒店(spremitura dell'oliva Rotondella)。内尔“皮亚琴蒂尼地区公园”里卡多诺因美洲国家组织世界自然基金会,魁拉德尔蒙特加速度和魁拉德尔波尔维拉奇。

谢谢你的时间和帮助

    <div id="content">
<div class="sub_corpo">
<div class="sub_sinistra">

<div id="slideshow">

<?php

$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_mime_type' => 'image',
'post_status' => null,
'post_parent' => $post->ID
);
$images = get_posts( $args );
foreach($images as $image):
echo wp_get_attachment_image($image->ID, 'full');
endforeach; ?></div>



<h1>Lunarossa vini e passione</h1>
<p>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</p>
</div>
<div class="sub_destra"><img src="http://www.viniepassione.it/wp-content/uploads/2011/09/parco.jpg" alt="Monti Picentini" />
<h1>&nbsp;</h1>
<p>I monti piacentini sono un gruppo montuoso dell'Appennino campano. I Monti picentini sono una terra il cui carattere morfologico &egrave; rimasto immutato nel tempo, cos&igrave; come le tipicit&agrave; gastronomiche, dalla nocciola Tonda di Giffoni al''olio delle colline salernitane ottenuto dalla spremitura dell'oliva Rotondella. Nel &quot;Parco regionale dei piacentini&quot; ricadono due oasi WWF, quella del monte Accellica e quella del Polveracchio.
</p>
</div>
</div>
</div>