framework7

Open full view…

2 callbacks for swipeout delete

Aurélien Praga
Thu, 29 May 2014 11:57:14 GMT

Hello, I would like to add a callback on a list generated with Ajax, here is my li: <li class="swipeout my-class"> <div class="swipeout-content item-content"> <div class="item-inner"> <div class="item-title">...</div> <div class="item-after">...</div> </div> </div> <div class="swipeout-actions"> <div class="swipeout-actions-inner"> <a href="#" class="swipeout-delete">Delete</a> </div> </div> </li> And the code to detect a swipeout: $$(document).on('deleted', '.my-class', function () { }); But this callback is executed 2 times for each click on the "Delete" button. How can I change that for only one callback ? Thank you

Vladimir Kharlampidi
Thu, 29 May 2014 12:07:39 GMT

It should be only once. What is your F7 library version?

Aurélien Praga
Thu, 29 May 2014 14:33:00 GMT

The last version get with bower: 0.8.5

Vladimir Kharlampidi
Thu, 29 May 2014 15:29:07 GMT

Then i need to see your example live. Cause it something wrong in your code. Otherwise the only reason which could cause this is that you also have same "my-class" class on some parent element, not only on <li>. You actually can see it in kitchen sink in swipeout example. It shows alert only once when item deleted (it is also on "deleted" event listener)

Aurélien Praga
Thu, 29 May 2014 19:37:14 GMT

It was a problem with the cache, I don't know why but it's ok now. Sorry for the inconvenience...