您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

IE9下Swiper控件不能准确定位到指定页面问题

2024/3/19 9:39:02发布23次查看
应用场景:
采用轮播控件对表格中的图片文件进行展示,当点击表格中的图片文件时,使用轮播控件(swiper)显示指定的图片,同时,可以左右翻页,前后浏览所有的图片。
实现思路:(1)使用js创建swiper的躯干(swiper相当于灵魂,灵魂必须依附肉体才能起作用)。
__createpreviewhtml: function(){ if($('#__sc1').length>0) return; var html = '<p id="__sc1" class="swiper-container" style="z-index:9999;">' + ' <a href="javascript:void(0);" id="__sc_closebtn" class="closebtn" title="close"> x </a>' + ' <p class="swiper-wrapper"> ' + '</p> ' + '<p class="swiper-pagination"></p>' + '<p class="swiper-button-prev"></p>' + '<p class="swiper-button-next"></p>' + '</p>'; $(document.body).append(html); $('#__sc_closebtn').on('click',this.__hidepreviewbox); }
(2)遍历表格中的图片文件,并塞入swiper的躯干,获取点击图片文件的索引号(index),url(通过文件id唯一标识)。
var index = 0; var i = 0; me._grid.findrow(function(row){ var fileid2 = row.fileid; var filename2 = row.filename.tolowercase(); if(filename2 && imgreg.test(filename2)==true){ if(fileid == fileid2){ index = i; } var picparam = me.fileservice + "/preview?fileid=" + encodeuricomponent(fileid2); var imghtml = '<img src="' + picparam + '"/>'; var $slide = $('<p class="swiper-slide">' + imghtml + '</p>'); $('.swiper-wrapper').append($slide); i++; } }); if(typeof(myswiper) != 'undefined'){ myswiper.removeallslides(); }
(3)创建swiper控件,同时使用swiper的slideto(index)方法定位到指定的位置,显示图片。
//$('.swiper-pagination span').eq(index).trigger('click'); });
以上就是ie9下swiper控件不能准确定位到指定页面问题 的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product