mishk0 / swiped

Swiped.js - pretty swipe list for your mobile application, written in pure JS
MIT License
303 stars 32 forks source link

Child elements aren't slidable #3

Closed gatkinsNZ closed 9 years ago

gatkinsNZ commented 9 years ago

Hi. This is great functionality, however I have come across the fact it doesn't work with child elements. While the parent element is slidable/movable, the inner elements aren't. Therefore, if you have an inner element that takes up most the parent element then this doesn't work.

This is due to the fact the touch event is binded to the document, not the specific element, and instead the delegate(event, cbName) method that is fired filters for just the parent elements name.

Any reason the events are not binded to the specific target element/s?

mishk0 commented 9 years ago

Thanks for the issue, I'll check it out. And will be better if you provide your HTML and parameters of calling

gatkinsNZ commented 9 years ago

Example below. The only difference to the sample code in the readme is the child p element

           <ul class="list1">
                <li>
                    &larr; you can swipe this bit <p>!but this bit here won't swipe!</p>
                </li>
            </ul>
            var a2 = Swiped.init({
                query: '.list1 li',
                right: 400,
                onOpen: function () {
                    this.destroy(true)
                },
                onClose: function () {
                    console.log('close')
                }
            });