jQuery Cycle + jCarousel Slideshow親指はロードされていませんか?
-
29-09-2019 - |
質問
JQuery CycleとJCarouselを組み合わせてスライドショーを作ることに取り組んでいます。 Firefox、Chrome、およびSafariでうまく機能しますが、IEではサムネイルが搭載されていません。
私はそれがポケットベルの画像がどのように生成されるかと関係があると推測しています、そして、JCarouselはそれをIEでプロデュースしていませんが、私は確信がありません。このスライドショーを機能させることに非常に近いように感じていますが、IEで失敗している理由を把握する必要があります。
これがHTMLコードです:
<!-- PHOTO SLIDESHOW CONTROLS -->
<div id="photo-slideshow-controls">
<a id="prev-btn" href="#">Prev</a>
<a id="next-btn" href="#">Next</a>
<a id="play" href="#">Play</a>
<a id="pause" href="#">Pause</a>
<div class="clear"></div>
</div><!--/PHOTO SLIDESHOW CONTROLS -->
<!-- PHOTO SLIDESHOW -->
<div id="advanced-slideshow">
<img src="assets/bridge-towers.jpg" width="593" height="474" alt="Bridge Towers" name="John Doe" />
<img src="assets/dixie-lan-bbq.jpg" width="632" height="474" alt="BBQ" name="Jane Doe l Associated Press" />
<img src="assets/downtown-overlook.jpg" width="632" height="421" alt="Overlooking Downtown Kansas City" name="Joel Johns l GardnerEDGE" />
<img src="assets/downtown-skyline.jpg" width="474" height="219" alt="Downtown Kansas City Skyline" name="Brett Jankord" />
<img src="assets/liberty-tower.jpg" width="356" height="474" alt="Liberty Tower" name="Steve Hengeli" />
<img src="assets/plaza-fountain.jpg" width="632" height="468" alt="Plaza Fountain" name="Kevin Wright l GardnerEDGE" />
<img src="assets/sprint-center.jpg" width="632" height="371" alt="Sprint Center" name="John Doe" />
<img src="assets/union-station.jpg" width="632" height="416" alt="Union Station at night" name="Jane Doe" />
<img src="assets/western-auto.jpg" width="632" height="474" alt="Western Auto" name="Kevin Wright l GardnerEDGE" />
<img src="assets/bridge-towers.jpg" width="593" height="474" alt="Bridge Towers" name="John Doe" />
<img src="assets/dixie-lan-bbq.jpg" width="632" height="474" alt="BBQ" name="Jane Doe l Associated Press" />
<img src="assets/downtown-overlook.jpg" width="632" height="421" alt="Overlooking Downtown Kansas City" name="Joel Johns l GardnerEDGE" />
<img src="assets/downtown-skyline.jpg" width="474" height="219" alt="Downtown Kansas City Skyline" name="Brett Jankord" />
</div><!--/PHOTO SLIDESHOW -->
<div id="photo-credit"></div>
<ul id="mycarousel" class="jcarousel-skin-tango">
</ul>
<div class="clear"></div>
<div id="slideshow-caption"></div>
したがって、サイクルはDiv#Advanced-SlideshowのIMGをスライドさせ、UL#MyCarouselのこれらの画像に基づいてサムネイルページャーを作成します。その後、JCarouselはUL#myCarouselのリスト項目を使用してカルーセルを構築します。 FF、Chrome、Safariの魅力のように機能しますが、IEで機能させる方法を理解できません。
これがJSコードです:
$(document).ready(function(){
// Adds ability to link to specifics slides
var index = 0, hash = window.location.hash;
if (hash) {
index = /\d+/.exec(hash)[0];
index = (parseInt(index) || 1) - 1; // slides are zero-based
}
// Setup for Cycle Plugin
$('#advanced-slideshow').cycle({
prev: '#prev-btn',
next: '#next-btn',
timeout: 0,
before: onBefore,
startingSlide: index,
pager: '#mycarousel',
// callback fn that creates a thumbnail to use as pager anchor
pagerAnchorBuilder: function(idx, slide) {
return '<li><a href="#"><img src="' + slide.src + '" width="75" height="75" /></a></li>';
}
});
//Pauses slideshow
$('#pause').click(function() { $('#photo-slideshow').cycle('pause'); return false; });
//Instantly resumes slidesshow
$('#play').click(function() { $('#photo-slideshow').cycle('resume', true); });
/* Delayed resumes slideshow
$('#play').click(function() { $('#photo-slideshow').cycle('resume'); return false; });
*/
function onBefore(curr,next,opts) {
// Centers the image
var $slide = $(next);
var w = $slide.outerWidth();
var h = $slide.outerHeight();
$slide.css({
marginTop: (476 - h) / 2,
marginLeft: (634 - w) / 2
});
// Centers the DIV vertically!!!!
var divHeight = 476;
var theImageHeight = $slide.outerHeight();
var newTopMargin = (divHeight - theImageHeight) / 2;
if(theImageHeight > 476){
$('#advanced-slideshow').css({
marginTop: newTopMargin
});
}
// Adds caption and credit line
$('#photo-credit').html('<p>' + "Photo By: " + this.name + '</p>')
$('#slideshow-caption').html(this.alt);
// Adds ability to link to certain slides
{window.location.hash = opts.currSlide + 1;}
};
//jCarousel
$('#mycarousel').jcarousel({
scroll: 5,
visible: 5,
});
}); // 終わり
これが私がこれまでに持っているものへのリンクです。 デモ
これに関する助けは大歓迎です!
解決
jQueryフォーラムのユーザーは、私が余分なものを持っていることを指摘しました、私はvisbile:5、visible:5を変更する必要がありました:5
うまくいき、今ではスライドショーがIEで機能します。 IE 6からIE 8をテストしました。Pageの最後ではなく、JSコードをヘッドタグにコードアップする場合、IEでより適切に機能する傾向があります。他の誰かがこれを使用したい場合に備えて、これを共有していると思いました。