我已經設置了一個滑塊,以便每次單擊下一個按鈕時,圖像將從不同的方向滑入。例如; 第一次點擊從頂部滑動 第二次從左側 第三次從頂部 第四次從左側e.t.c e.t.c.多方向滑塊
到目前爲止,我的前三個工作正常,但第四次點擊後,圖像只能從側面滑入。
這裏是我迄今爲止
<script type="text/javascript">
var totalslides = '6';
var slidenum = 0;
var slidenext = 0;
var slideType = '';
$(function(){
$('#gallery-next').data('counter',1);
$('#gallery-next').click(function() {
slidenum = parseInt($('#gallery-next').data('counter'));
slidenext = slidenum+1
slideType = $('#'+slidenum+'-slide').attr('class')
slideType = slideType.split('-')[0]
if (slideType =='') slideType='up';
else slideType = 'right';
//alert('Next slideType is: ' + slideType)
//hide(slide) is a jQueryUI function, so ensure you include that lib
$('#'+slidenext+'-slide').delay(605).show('slide',{direction:slideType}, 1000);
$('#'+slidenum+'-slide').fadeOut(600);
$('#'+slidenext+'-text').delay(731).fadeIn(1000);
$('#'+slidenum+'-text').fadeOut(600);
slidenum = slidenum % totalslides + 1;
$('#gallery-next').data('counter',slidenum);
console.log(slideType);
});
});
</script>
<div id="slider">
<section class="horizontal-gallery">
<img src="images/waikanae/crafar_h1.jpg" class="" id="1-slide"/>
<p id="1-text" class="horizontal-gallery-text">This is the first image in the gallery </p>
</section>
<section class="vertical-gallery">
<img src="images/waikanae/crafar_v1.jpg" class="picture2 init-hidden" id="2-slide"/>
<p id="2-text" class="vertical-gallery-text init-hidden">This is the second image in the gallery, it should be sliding down</p>
</section>
<section class="horizontal-gallery">
<img src="images/waikanae/crafar_h1.jpg" class="picture3 init-hidden" id="3-slide"/>
<p id="3-text" class="horizontal-gallery-text text-3 init-hidden">This is the third image in the gallery it should be sliding in from the side </p>
</section>
<section class="vertical-gallery">
<img src="images/waikanae/crafar_v1.jpg" class="picture4 init-hidden" id="4-slide"/>
<p id="4-text" class="vertical-gallery-text text-4 init-hidden">This is the fourth image in the gallery, it should be sliding down </p>
</section>
http://luvly.co.nz/space/test/waikanae-beach-house.html
如果有人能弄清楚爲什麼它不能正常工作,將不勝感激! 乾杯
這裏是正在發生的例子:http://luvly.co.nz/space/test/waikanae-beach-house.html如何我可以去 – Spade 2013-02-25 00:28:37