darsain / sly

JavaScript library for one-directional scrolling with item based navigation support.
http://darsa.in/sly
2.87k stars 497 forks source link

Destroy via proxy is not working #212

Closed vedmaka closed 9 years ago

vedmaka commented 9 years ago

I've noticed that destroying slider via proxy method is not working:

$("#myslider").sly(false);

Only direct destroy call works. You can try it yourself at Sly promo page: Navigate to http://darsa.in/sly/ , open JS console and execute this code:

$('.frame').sly(false);

Nothing was destroyed.

vedmaka commented 9 years ago

Btw, none of methods working when called via proxy - you can test it at http://darsa.in/sly/ too. Eg:

$('.frame').sly('slideTo',100);

Do nothing.

vedmaka commented 9 years ago

Update: made few test and found that destroy via proxy working only if slider was initialized via proxy:

$('#frame').sly({ ...options.. })
vedmaka commented 9 years ago

Reason why this happening is that reference to Sly instance stored in data attribute only when Sly created via proxy. Pull request: #213

darsain commented 9 years ago

Yeah, that was kinda by design, but I guess it makes sense while Sly still supports jQuery. I'm gonna implement your fix.

And sorry for the delay :neutral_face:.

darsain commented 9 years ago

Should be fixed now.

vedmaka commented 9 years ago

Hooray, thanks! :smile_cat: