我需要一個滑塊在一個循環中工作,我使用下面的代碼我們如何使用滑塊一個循環中
while (have_posts()) : the_post(); ?>
<div id="content">
<?php
$attachments = get_children(array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'order' => '',
'post_mime_type' => 'image')
);
echo "aaaaa".count($attachments);
?>
<?php if(count($attachments)!=0){ ?>
<div id="portfolio-gallery">
<ul id="slideshow_detail">
<?php
foreach ($attachments as $att_id => $attachment) {
$getimage = wp_get_attachment_image_src($att_id, 'room-gallery', true);
$roomimage = $getimage[0];
echo '<li>
<h3></h3>
<span>'.$roomimage.'</span>
<p></p>
<img src="'.$roomimage.'" alt="" class="thumb-slide" />
</li>';
}
?>
</ul>
<div id="wrapper1">
<div id="fullsize">
<div id="imgprev" class="imgnav" title="Previous Image"></div>
<div id="imglink"></div>
<div id="imgnext" class="imgnav" title="Next Image"></div>
<div id="image"></div>
<div id="information">
<h3></h3>
<p></p>
</div>
</div>
<div id="thumbnails">
<div id="slideleft" title="Slide Left"></div>
<div id="slidearea">
<div id="slider-room"></div>
</div>
<div id="slideright" title="Slide Right"></div>
</div>
</div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
<!--
$('slideshow_detail').style.display='none';
$('wrapper1').style.display='block';
var slideshow_detail=new TINY.slideshow_detail("slideshow_detail");
window.onload=function(){
slideshow_detail.auto=true;
slideshow_detail.speed=5;
slideshow_detail.link="linkhover";
slideshow_detail.info="information";
slideshow_detail.thumbs="slider-room";
slideshow_detail.left="slideleft";
slideshow_detail.right="slideright";
slideshow_detail.scrollSpeed=4;
slideshow_detail.spacing=25;
slideshow_detail.active="#fff";
slideshow_detail.init("slideshow_detail","image","imgprev","imgnext","imglink");
}
//-->
</script>
</div>
<?php endwhile;?>
通過使用此代碼滑塊工作只有一次,我需要工作滑塊在一個循環下。 即我要添加多個崗位,每個崗位有。我有使用滑塊
您在每個while循環中包含JS。所以如果它有效,它會被多次註冊。將你的JS移出循環。 – janw 2013-03-20 10:50:00