TA的每日心情 | 慵懒 2019-8-26 15:39 |
---|
签到天数: 1 天 [LV.1]初来乍到
注册会员
- 积分
- 96
|
本帖最后由 疯子蚁 于 2015-9-21 10:42 编辑
- var eHeight0,eHeight1,eHeight2;
- var mySwiper = new Swiper('.swiper-container', {
- resistanceRatio : 1,
- onInit: function(swiper){
- eHeight0 = swiper.slides[0].offsetHeight+'px';
- eHeight1 = swiper.slides[1].offsetHeight+'px';
- eHeight2 = swiper.slides[2].offsetHeight+'px';
- alert(eHeight2)
- switch(swiper.activeIndex)
- {
- case 0:
- swiper.container[0].style.height=eHeight0;
- break;
- case 1:
- swiper.container[0].style.height=eHeight1;
- break;
- case 2:
- swiper.container[0].style.height=eHeight2;
- break;
- }
- // swiper.container[0].style.height=swiper.slides[swiper.activeIndex].offsetHeight+'px';
- },onSlideChangeStart: function(swiper){
- //var eHeight0 = swiper.slides[0].offsetHeight+'px';
- //var eHeight1 = swiper.slides[1].offsetHeight+'px';
- //var eHeight2 = swiper.slides[2].offsetHeight+'px';
- switch(swiper.activeIndex)
- {
- case 0:
- swiper.container[0].style.height=eHeight0;
- alert('0');
- break;
- case 1:
- swiper.container[0].style.height=eHeight1;
- alert('1')
- break;
- case 2:
- swiper.container[0].style.height=eHeight2;
- alert('2')
- break;
- }
- // swiper.container[0].style.height=swiper.slides[swiper.activeIndex].offsetHeight+'px';
- // alert(swiper.activeIndex);
- // alert(swiper.slides[swiper.activeIndex].offsetHeight+'px');
- //alert(swiper.slides[swiper.activeIndex].offsetHeight+'px');
- },
- direction: 'horizontal',
- loop: false,
- calculateHeight: true,
- effect: 'coverflow',
- useCSS3Transforms:'false',
- // 如果需要分页器
- pagination: '.swiper-pagination',
- // 如果需要前进后退按钮
- // nextButton: '.swiper-button-next',
- // prevButton: '.swiper-button-prev',
- // 如果需要滚动条
- // scrollbar: '.swiper-scrollbar',
- })
复制代码 先将就吧 等大神来 |
|