swiper

Open full view…

event/callback not working

aherranzs
Wed, 29 Apr 2015 18:02:34 GMT

Hi, I am using the swipper, and it seems to work very well, but now I am trying to attach an event to a swipper like in the API example: var swiperVert = new Swiper('.swiper-vert', { //pagination: '.swiper-paginationVert', paginationClickable: true, direction: 'vertical', grabCursor: true }); swiperVert.on('slideChangeStart', function () { console.log('slide change start'); }); ...and it gives me the following error in the console: Uncaught TypeError: swiperVert.on is not a function (anonymous function) @ funcionalidad.js:48 jQuery.Callbacks.fire @ jquery-1.10.2.js:3048 jQuery.Callbacks.self.fireWith @ jquery-1.10.2.js:3160 jQuery.extend.ready @ jquery-1.10.2.js:433 completed @ jquery-1.10.2.js:104 I have tried to avoid using jQuery, and use only the swipper version of jquery, but it also gives me an error not founding jQuery instance in dragonpen library (and also in Bootrap), so it is not the problem I think (I have seen it is reccomended to use the swipper jquery version, but I can't). Why cannot be the event recognised as a function?? Any help is welcome, thank you so much.

aherranzs
Wed, 29 Apr 2015 20:59:13 GMT

Resolved! I was trying to use it as a function, rather tan including as a parameter of the swipper object while iniatilizing: swiperVert = new Swiper('.swiper-vert', { pagination: '.swiper-paginationVert', paginationClickable: true, direction: 'vertical', grabCursor: true, onSliderMove: function (swiper, event) { console.log('mueve el swipper'); } });

Vladimir Kharlampidi
Thu, 30 Apr 2015 14:37:05 GMT

Are you sure that you use latest Swiper version? Such `.on` methods become available since version `3.0.5`

aherranzs
Sat, 09 May 2015 20:23:59 GMT

Yeah, I was not using the last version. Thanks!