2012. szeptember 21., péntek 19:42:04 UTC+2 időpontban petrob a következőt írta: > > This is a call to everyone to correct the mistake in positionedOffset in > your individual copy of Prototype as it DOES cause totally wrong return > values to come back as soon as the margin-left and the margin-top values > are not equal. This SERIOUSLY INFLUENCES the values you get whenever you > create a Layout object: > Change the src attribute to point to your copy of Prototype and then you > will ALWAYS get negative values for either left or right when margin-left / > margin-right are higher than 0 and are not equal. >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html;charset=iso-8859-2" /> <title>clonePosition function test</title> <script type="text/javascript" language = "javascript" src="js/Prototype_1_7_1.js"></script> <style type="text/css"> #container{ width: 500px; height: 600px; background-color: lightgray; position: absolute; top: 30px; left: 30px; } #target_div{ width: 200px; height: 300px; margin-top: 20px; margin-left: 10px; background-color: green; } #display{ position: absolute; top: 30px; left: 550px; width: 300px; background-color: wheat; } #target_display{ border: 1px solid red; height: 300px; overflow: auto; } h2{ padding: 0; margin: 3px 10px; } *.block{ display: block; margin: 5px 10px; } *.vertical_space{ padding-top: 10px; } </style> <script language="javascript" type="text/javascript"> Event.observe(window, 'load', function(){ var target = $('target_div'); var target_display = $('target_display'); var template = "<span class=\"vertical_space block\">#{key}" + " : #{value}</span>"; var tLayout = new Element.Layout(target,true); var tObj = tLayout.toObject(); var keys = Object.keys(tObj); keys.each(function(key){ target_display.innerHTML += template.interpolate({key: key, value: tObj[key]}); }); alert('left : ' + tLayout.get('left') + '\n top: ' + tLayout.get('top')); }); </script> </head> <body> <div id="container"> <div id="target_div">target_div</div> </div> <div id="display"> <div id="target_display"><h2>target data</h2></div> </div> </body> </html> -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To view this discussion on the web visit https://groups.google.com/d/msg/prototype-scriptaculous/-/dF49zKLTrDAJ. To post to this group, send email to prototype-scriptaculous@googlegroups.com. To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.