Solved

JQuery draggable helper

Posted on 2013-11-19
4
295 Views
Last Modified: 2013-11-28
Hi,

I am using a helper to create a new elemnt to drag. This element is initially set to be positioned absolutely -42px from top . But, when the helper gets activated the top position gets reset to 0.

Is there a way to prevent the absolute position getting reset?

This also affects "revert". i.e when the element is not dropped on the target it reverts back to initial position,  which isnt the absolute position i set within css

Thanks
0
Comment
Question by:coolispaul
  • 2
  • 2
4 Comments
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 39659631
But what's your idea?
top: -42px will put your element off screen, what are you trying to accomplish?
0
 

Author Comment

by:coolispaul
ID: 39659666
well, no because its positioned relative to another element.

essentially, it sits on top of another element.

I want the "helper" to maintain this position, but it goes back to its actual position on the page.

Thanks
0
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 500 total points
ID: 39659712
Well, you must be doing something wrong in your code.
Here's a working sample based on the one on the official jQuery UI website:
http://jsfiddle.net/gkPKL/

Original sample: http://jqueryui.com/droppable/#revert

I changed it a bit to try to simulate what you described but the final result was not the same as you have.
0
 

Author Comment

by:coolispaul
ID: 39659739
oh ok - thanks for that

'll try and fix based on your example

Thanks again
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
gif banner animation loads randomly in mobile 3 39
JavaScript Scope issue 4 20
modify h2 4 20
Different Delete Messages 7 23
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now