Closed Bellzzy closed 9 years ago
任何一个对像移动时,都会影响onslidechange:
islider1 = new iSlider({ data: domlist, type:'dom', dom: document.getElementById("iSlider-show"), duration: 3000, animateType: 'default', isAutoplay: true, isLooping: true, onslideend: function(idx){ idx = idx +1; if(idx>=$("#iSlider-show li").size()){ idx =0; } $(".advtitle").html($("#iSlider-show img:eq("+idx+")").attr("alt")) }, onslidechange: function(idx){ idx = idx +1; if(idx>=$("#iSlider-show li").size()){ idx =0; } $(".advtitle").html($("#iSlider-show img:eq("+idx+")").attr("alt")) } });
islider2 = new iSlider({ data: domCate, type:'dom', dom: document.getElementById("iSlider-show-c"), duration: 3000, animateType: 'default', isAutoplay: false, isLooping: true });
如代码所示,操作islider2时,islider1的onslidechange也会有反映,也就是说onslidechange捕捉了两个对象的事件。
你可以在页面上把islider1和islider2这两个对象打印一下吗?
目前项目中已经换别的方法,但还是很喜欢iSlider.
任何一个对像移动时,都会影响onslidechange:
islider1 = new iSlider({ data: domlist, type:'dom', dom: document.getElementById("iSlider-show"), duration: 3000, animateType: 'default', isAutoplay: true, isLooping: true, onslideend: function(idx){ idx = idx +1; if(idx>=$("#iSlider-show li").size()){ idx =0; } $(".advtitle").html($("#iSlider-show img:eq("+idx+")").attr("alt")) }, onslidechange: function(idx){ idx = idx +1; if(idx>=$("#iSlider-show li").size()){ idx =0; } $(".advtitle").html($("#iSlider-show img:eq("+idx+")").attr("alt")) } });
islider2 = new iSlider({ data: domCate, type:'dom', dom: document.getElementById("iSlider-show-c"), duration: 3000, animateType: 'default', isAutoplay: false, isLooping: true });
如代码所示,操作islider2时,islider1的onslidechange也会有反映,也就是说onslidechange捕捉了两个对象的事件。