I've figured out part of my problem. One issue is that in order to change the helper, you have to pass a function as the parameter, not a jQuery object. The other issue is that when the helper is changed, the view isn't updated, so you'll only see the change if you drag the .draggable
object a second time. This clarifies things for me, but I still need to figure out how to get the new helper to appear during the original drag. Any advice is appreciated.
manpreet
Best Answer
2 years ago
I'm trying to have a
.draggable()
object's helper change according to where it is on the screen. To do it, I'm using the helper's set function, with the value being HTML generated from a separate template. By usingconsole.log()
statements to see what the helper is, I can see that the HTML has changed appropriately (at least I'm fairly certain), but the helper itself is not changing on-screen. For some context, this is CoffeeScript in a Backbone.js view. Here's my code:To clarify, the helper starts out as a clone, and when I hover over the object with the correct scope, it should change to the new HTML object from the template. When I leave the scope, it should return to the clone. Here's the jQuery object for the helper before I change it and after:
And as a final note, I've styled this new div in CSS with visible features, so I know it's not the case that my div is just empty so I can't see it. If anyone has any idea why this isn't working, I'd really appreciate it. Thanks.