2011-09-15 5 views
0

jquery .load関数でロードされたコンテンツの内部にjqueryインナーファンクションをロードしようとしていますが、これに似たトピックが多数見られますが、適切なソリューションを入手してください。ajaxedコンテンツ内の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) 
    } 
}); 

$('.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; 

}); 

})。私は、コンテンツがロードされたときに、この関数を呼び出す方法がわからない

<script > 
function(){ 

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

が、これはinnerfade機能です。私は本当にあなたの提案に感謝します。

Dimtiri

答えて

0

これが答えのようになります。

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

ショーンありがとう、それは動作しません... – Dimitri

0

私はそれをテストしてみたが、動作していないよう、ご提案していただきありがとうございます。

<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> 

ありがとう:

$(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; 

}); 

}); 

ただ、もっとに関する情報を与えるために、これは「コンテンツ」のdivの中にjQueryを介してロードする必要があるページのコードは次のとおりです。 これは、新しい最終jqueryのコードですあなたの時間と助けのために

関連する問題