js手机幻灯片代码制作手指滑动手机端图片轮播代码



192 765 256



特效描述:js 手机幻灯片 代码制作 手指滑动 手机端图片轮播,js手机幻灯片代码制作手指滑动手机端图片轮播

代码结构

1. 引入CSS

<link rel="stylesheet" href="css/style.css" />

2. 引入JS

<script src="js/islider.js"></script>
<script src="js/plugins/islider_desktop.js"></script>

3. HTML代码

<h4 style="text-align: center">animateType参数中设置,目前支持default, rotate, flip 和 depth, 点击按钮看效果</h4>
<div id="iSlider-effect-wrapper">
    <div id="animation-effect" class="iSlider-effect"></div>
</div>
<div id="menu-select">
    <span class="on">default</span>
    <span>rotate</span>
    <span>flip</span>
    <span>depth</span>
</div>
<h4 style="text-align: center">垂直轮播</h4>
<div id="vertical-slide" class="iSlider-effect"></div>
<h4 style="text-align: center">不循环模式(最始及最末图片滑动会有衰减效果)</h4>
<div id="non-looping" class="iSlider-effect"></div>
<h4 style="text-align: center">DOM</h4>
<div id="dom-effect" class="iSlider-effect"></div>
<script>
var picList = [
{
	width: 150,
	height: 207,
	content: "images/1.jpg",
},
{
	width: 150,
	height: 207,
	content: "images/2.jpg",
},
{
	width: 150,
	height: 207,
	content: "images/3.jpg",
},
{
	width: 150,
	height: 207,
	content:"images/5.jpg"
},
{
	width: 150,
	height: 207,
	content:"images/6.jpg"
},
{
	width: 300,
	height: 414,
	content:"images/7.jpg"
},
{
	width: 150,
	height: 207,
	content:"images/8.jpg"
},
{
	width: 150,
	height: 207,
	content:"images/9.jpg"
}
];
var domList = [
{
	'height' : '100%',
	'width' : '100%',
	'content' : '<div><h1>Home</h1><h2>This is home page</h2><p>home is pretty awsome</p><div>'
},{
	'height' : '100%',
	'width' : '100%',
	'content' : '<div><h1>Page1</h1><h2>This is page1</h2><p>page1 is pretty awsome</p><div>'
},{
	'height' : '100%',
	'width' : '100%',
	'content' : '<div><h1>Page2</h1><h2>This is Page2</h2><p>Page2 is pretty awsome</p><div>'
},{
	'height' : '100%',
	'width' : '100%',
	'content' : '<div><h1>Page3</h1><h2>This is page3</h2><p>page3 is pretty awsome</p><div>'
}
];
//all animation effect
var islider1 = new iSlider({
	data: picList,
	dom: document.getElementById("animation-effect"),
	duration: 2000,
	animateType: 'default',
	isAutoplay: true,
	isLooping: true,
	// isVertical: true, 是否垂直滚动
});
islider1.bindMouse();
//vertical slide
var islider2 = new iSlider({
	data: picList,
	dom: document.getElementById("vertical-slide"),
	duration: 2000,
	animateType: 'default',
	isVertical: true,
	isAutoplay: true,
	isLooping: true,
});
islider2.bindMouse();
//不循环 不自动播放
var islider3 = new iSlider({
	data: picList,
	dom: document.getElementById("non-looping"),
	animateType: 'default',
});
islider3.bindMouse();
//滚动dom
var islider4 = new iSlider({
	data: domList,
	dom: document.getElementById("dom-effect"),
	type: 'dom',
	animateType: 'default',
	isAutoplay: true,
	isLooping: true,
});
islider4.bindMouse();
var menu = document.getElementById('menu-select').children;
function clickMenuActive(target) {
	for (var i = 0; i < menu.length; i++) {
		menu[i].className = '';
	}
	target.className = 'on';
}
menu[0].onclick = function() {
	clickMenuActive(this);
	islider1._opts.animateType = this.innerHTML;
	islider1.reset();
};
menu[1].onclick = function() {
	clickMenuActive(this);
	islider1._opts.animateType = this.innerHTML;
	islider1.reset();
};
menu[2].onclick = function() {
	clickMenuActive(this);
	islider1._opts.animateType = this.innerHTML;
	islider1.reset();
};
menu[3].onclick = function() {
	clickMenuActive(this);
	islider1._opts.animateType = this.innerHTML;
	islider1.reset();
};
</script>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: 滑动滑过 滚动切换 滑动选项卡切换 flash焦点图 选项卡切换 滑动手风琴 焦点图幻灯片 图片滑动 图片切换 图片轮播

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到