$(function () { var ViewPicture = { $picList: '', winW: $(window).width(), winH: $(window).height(), index: 0, distance: 10, events: [ 'touchstart', 'touchmove', 'touchend'], init: function () { this.bindEvent( $('.i-i-l-item'), this.events[0] ,function () { console.log($(this).index()); }) }, bindEvent: function ( d, ev, cb, ld) { cb && d.on( ev, ld, function (e){ cb.call( this, e); }); } }; ViewPicture.init(); });