Solved

JQuery draggable helper

Posted on 2013-11-19
4
299 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

825 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