Muuri: Can't click a button inside an item in muuri grid

Created on 17 May 2019  路  1Comment  路  Source: haltu/muuri

I have a grid with items which contains buttons in them. But when I tried to click on them, first the dragStart event for grid is triggered and button click won't work.
Is there anyway to prioritize the button click over the dragStart event?

question

Most helpful comment

Use dragStartPredicate function (see documentation). Returning false will ignore dragging.

dragStartPredicate: function (item, hammerEvent) {
               // Don't drag if target is button
                if (hammerEvent.target.matches("button")) {
                    return false;
                }
               // handle Drag
                return true;
            },

>All comments

Use dragStartPredicate function (see documentation). Returning false will ignore dragging.

dragStartPredicate: function (item, hammerEvent) {
               // Don't drag if target is button
                if (hammerEvent.target.matches("button")) {
                    return false;
                }
               // handle Drag
                return true;
            },
Was this page helpful?
0 / 5 - 0 ratings

Related issues

msdobrescu picture msdobrescu  路  5Comments

qq164654109 picture qq164654109  路  5Comments

syfgkjasdkn picture syfgkjasdkn  路  3Comments

claudchan picture claudchan  路  6Comments

bsherwoodofdaptiv picture bsherwoodofdaptiv  路  4Comments