odyniec / imgareaselect

ImgAreaSelect is a jQuery plugin for selecting a rectangular area of an image. It allows web developers to easily implement image cropping functionality, as well as other user interface features, such as photo notes (like those on Flickr).
http://odyniec.net/projects/imgareaselect/
686 stars 197 forks source link

created elements position erroneously gets set to fixed #95

Open willherzog opened 6 years ago

willherzog commented 6 years ago

I discovered upon first attempting to use this plugin that, since one of the target image's parent elements was using fixed positioning (it was a modal window), the new elements created by the plugin were also using fixed positioning and were therefore wildly out of position from where they were supposed to be. Clearly in my case they should have been using the default absolute positioning.

I managed to find the culprit code on lines 1123-1125 (of version 0.9.10) where it starts with this comment: "Also check if any of the ancestor elements has fixed position" - removing these lines fixed the problem for me.

I'm not sure why it was using fixed positioning if any parent element used fixed positioning, but clearly this part of the code needs to be made more sophisticated!