ducksboard / gridster.js

gridster.js is a jQuery plugin that makes building intuitive draggable layouts from elements spanning multiple columns
http://gridster.net/
MIT License
6.03k stars 1.2k forks source link

add_widget on button click #362

Closed marco-gagliardi closed 10 years ago

marco-gagliardi commented 10 years ago

Don't know if it can be considered an actual issue, anyway it seems that the "button onclick handler" can't work properly with the add_widget function. Check this out: http://jsfiddle.net/H6dCR/ Adding a widget in the outer scope works properly. Even binding the function to "mouseover" event instead of "click" (on the same button) works fine.

BorisKozo commented 10 years ago

I think you forgot to cancel default button action: http://jsfiddle.net/zbzzn/H6dCR/2/

marco-gagliardi commented 10 years ago

Sure, it makes perfectly sense! Thank you!