javascript - negative boundingClientRect value for text inside cufon and cufontext tags.. How to get positive boundingClientRect of That text? -
my code goes below...
<cufon class="cufon cufon-canvas" alt="john " style="width: 59px; height: 24px;"> <canvas width="76" height="25" style="width: 76px; height: 25px; top: 0px; left: -1px;"></canvas> <cufontext> <cufon class="cufon cufon-canvas" alt="john " style="width: 5px; height: 1px;"> <canvas width="6" height="2" style="width: 6px; height: 2px; top: 0px; left: 0px;"> </canvas> <cufontext>john </cufontext> </cufon> </cufontext>
i need correct boundingclientrect object..
i trying below code giving negative value rect.left , rect.right..
if(documentnode.createrange){ var range = documentnode.createrange(); range.selectnodecontents(textnode); if (range.getboundingclientrect) { var rect = range.getboundingclientrect(); if (rect) { y = rect.top; h = rect.bottom - rect.top; w = rect.right - rect.left; x = rect.left; } } }
pls help
Comments
Post a Comment