FrostiE Posted July 28, 2007 Share Posted July 28, 2007 Hey, One of the things I'm trying to get working at the moment is dynamic thumbnailing. Basically the user has the choice for a auto thumbnail (crop to 1:1 proportion ratio, and resize) or a manual thumbnail. http://ewanfrost.com/modman/thumbnail.php -> (haven't tried IE compatibility yet, since its just a tech test) Ok, so I'm trying to test it in some kinda gallery environment (picture above). By click on the image, if makes a absolute positioned DIV appear, and loads dynamic content (the larger image and scroller) using Prototype's AJAX.Updater function. The problem is, if I try and find the the left position of the image offsetLeft, it returns 0. I assume this is because its 0 px away from the side of the div. Does anyone know how I could insert it into the DOM where it is considered part of the document and the calculations will involve the whole document, if not, any suggestions and ideas would be great. Thanks! Quote Link to comment Share on other sites More sharing options...
mainewoods Posted July 29, 2007 Share Posted July 29, 2007 function findPos(obj) { var curleft = curtop = 0; if (obj.offsetParent) { curleft = obj.offsetLeft curtop = obj.offsetTop while (obj = obj.offsetParent) { curleft += obj.offsetLeft curtop += obj.offsetTop } } return [curleft,curtop]; } http://www.quirksmode.org/js/findpos.html --works great, I use it. Quote Link to comment Share on other sites More sharing options...
FrostiE Posted July 29, 2007 Author Share Posted July 29, 2007 Thanks a lot dude, I actually kind of figure out a way, by just constraining the object inside the parent div, which also makes the dragging a lot nicer, but this is going to be helpful ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.