我在前一段时间和今天设置了这张幻灯片,试图修复一些错误,我更新了库代码。
在一些测试中,我注意到电脑拖放不再起作用了,但触摸事件确实如此,但我不确定它是否有效,因为它已经有一段时间了,因为我检查。
有什么问题吗? 这是代码:
图片html模板:
<div>
<img u="image" src="url" />
<div u="thumb">
<div style="width: 100%; height: 100%; background-image: url('url'); background-size: contain; background-repeat:no-repeat; background-position:center;"></div>
</div>
</div>
Slider.js:
var jssor_slider1;
function getContentHeight(){
return $(window).height()-$("#container").offset().top;
}
jQuery(document).ready(function ($) {
var options = {
$ArrowKeyNavigation: true,
$FillMode: 5,
$AutoPlay: true,
$ArrowNavigatorOptions: {
$Class: $JssorArrowNavigator$,
$ChanceToShow: 2
},
$ThumbnailNavigatorOptions: {
$Class: $JssorThumbnailNavigator$,
$ChanceToShow: 2,
$SpacingX: 8,
$Cols: 10,
$Align: 0
}
};
$("#play_button").attr("state", "active");
jssor_slider1 = new $JssorSlider$('slider1_container', options);
function ScaleSlider() {
var parentWidth = $("#container").innerWidth();
if (parentWidth){
var windowHeight = getContentHeight()*0.83;
var originalWidth = $("#slider1_container").width();
var originalHeight = $("#slider1_container").height();
var thumbHeight = originalHeight/6;
originalHeight += thumbHeight;
var scaleWidth = parentWidth;
if (parentWidth / originalWidth > windowHeight / originalHeight) {
scaleWidth = Math.ceil((windowHeight / originalHeight )* originalWidth);
}
jssor_slider1.$SetScaleWidth(scaleWidth);
}
else
window.setTimeout(ScaleSlider, 30);
}
function play(){
jssor_slider1.$Play();
$("#play_button").attr("state", "active");
$("#play_button").one("click", pause);
}
function pause(){
jssor_slider1.$Pause();
$("#play_button").attr("state", "deactive");
$("#play_button").one("click", play);
}
$("#play_button").one("click", pause);
$(window).bind("load", ScaleSlider);
window.setTimeout(ScaleSlider, 30);
if (!navigator.userAgent.match(/(iPhone|iPod|iPad|BlackBerry|IEMobile)/)) {
$(window).bind('resize', ScaleSlider);
}
});
提前致谢
答案 0 :(得分:0)
这个问题是由库中的一个错误引起的,现在借助于jssor它已经修复了。