Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Display var data from javascript on html page?
Hello,
I am working on a personal website with very limited knowledge of html, so I apologize for the simplicity of the question in advance.
Below is the link to the script I'm trying to implement. It's an image magnifying script which basically uses two different sizes of the same image to create the effect. In addition to the magnifying effect, I'm trying to display the real time coordinates of the large native image when the mouse is hovering over the image.
http://cssdeck.com/labs/eusv0ui9
With the help of awesome folks from here, I was able to get the html page to display the real time coordinates of the smaller image on the page. I was wondering if it were possible to display the coordinates of the larger native image (background image inside the magnifying glass) instead.
Any help would be greatly appreciated.
Thank you.
1 Answer
- ChrisLv 74 years agoFavorite Answer
This the the line that updates the coordinates:
$("#mouseXY").html(`X: ${mouse.x}, Y: ${mouse.y}`);
Just insert the magnification factor:
$("#mouseXY").html(`X: ${mouse.x * 2}, Y: ${mouse.y * 2}`);