Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
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 using console.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:
.draggable()
console.log()
$('#syllabus').droppable({ scope: "components", over: (event, ui) -> $('#new_plaintext_button').draggable("option", "helper", $(JST["backbone/templates/components/box"]())) out: -> $('#new_plaintext_button').draggable("option", "helper", "clone") })
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:
[i.fa.fa-3x.fa-file-text-o.ui-draggable.ui-draggable-handle.ui-draggable-dragging, prevObject: jQuery.fn.jQuery.init[1], context: i#new_plaintext_button.fa.fa-3x.fa-file-text-o.ui-draggable.ui-draggable-handle, constructor: function, init: function, selector: ""…] [div#component_box, prevObject: jQuery.fn.jQuery.init[1], context: document, constructor: function, init: function, selector: ""…]
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.
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.
.draggable
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.