Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.
How can I create a popup of an image when you mouse over a graphic?
2012-01-24 12:50:00
where is ur code
2010-02-27 04:22:00
Hi DocThere are two ways in which you can do it. Javascript pop ups or Ajax. Javascript will open a separate window, which you can size as you wish. Ajax will open the image withotu creating another browser window. For Javascript you can use the following script on the body:<!-- // This is the function that will open the// new window when the mouse is moved over the linkfunction open_new_window() {new_window = open("","hoverwindow","width=300,height=200,left=10,top=10");// open new document new_window.document.open();// Text of the new document// Replace your " with ' or " or your document.write statements will failnew_window.document.write("JavaScript New Window");new_window.document.write("");new_window.document.write("This is a new html document created by JavaScript ");new_window.document.write("statements contained in the previous document.");new_window.document.write("");new_window.document.write("");// close the documentnew_window.document.close(); }// This is the function that will close the// new window when the mouse is moved off the linkfunction close_window() {new_window.close();}// -->
Open Hover Window
For Ajax, it depends a lot on how you want it done. I suggest just using an already built Ajax photo album. Where do you intend on using that feature? A store? An album? a persona site?