JavaScript - Div Disappears On Image Map Mouseover. Need It To Stay Open To Click Link In Div
I have a map with hotspots, and when you hover over a hot spot, a hidden DIV appears. Thanks to my favorite coding forum, this one, I was able to successfully accomplish this first bit of code. The only problem I'm having now is getting the DIV to remain open while I move my mouse from the hotspot to the DIV. As soon as I move my mouse away from the hotspot, the DIV disappears. I need to put links in the DIVs, and users will need to be able to move their mouse away from the hotspot to click on the link, but currently can't.
I experimented with setTimeout, but didn't get too far. If anyone could help me, I'd appreciate it. I really need to get this working. Code: <img src="images/map.png" alt="" usemap="#map"/> <map id="map" name="map"> <area shape="rect" coords="211,84,225,97" href="#" alt=""/> <area shape="rect" coords="226,78,240,92" href="#" alt=""/> <area shape="rect" coords="353,66,376,89" href="#" alt=""/> </map> <div id="hidden"> <div class="location" style="left:25px; top:-290px;"> <img src="images/location01.jpg" alt=""/> </div> <div class="location" style="left:25px; top:-275px;"> <img src="images/location02.jpg" alt=""/> </div> <div class="location" style="left:275px; top:-285px;"> <img src="images/location03.jpg" alt=""/> </div> </div> <!-- #hidden --> Code: function show(which) { var area = document.getElementById("map").getElementsByTagName("area"); var locations = document.getElementById("hidden").getElementsByTagName("div"); for (var a=0; a < area.length; ++a) { if(area[a] == which) locations[a].style.display="block"; } } function hide() { var locations = document.getElementById("hidden").getElementsByTagName("div"); for (var d=0; d < locations.length; ++d) { locations[d].style.display="none"; } } function init() { var area = document.getElementById("map").getElementsByTagName("area"); for (var a=0; a < area.length; ++a) { area[a].onmouseover = function() { show(this); } area[a].onmouseout = hide; } } window.onload = init; Similar TutorialsOk, first let me explain what I try to do. I have a menu with some items containing a submenu. The submenu's should open when a parent is clicked and contains submenu's, and when traveling to another page (from the item clicked, for example a parent of submenu item), the submenu should remain active and visible. When I click on a parent (at the moment the hrefs contain no links just #), the submenu opens. But when I click another main item, the submenu of the previous parent remain visible, and the submenu of the parent just clicked is also visible, while I only want the submenu of the parent clicked to be visible or when parent with no submenu the submenu should be invisible. So, here is the code I have so far: Code: <div id="topnav"> <ul> <li> <a href="index.html">Home</a> </li> <li> <a href="#">Over Meves</a> <ul class="submenu"> <li><a href="#" class="suba">Historie</a></li> <li><a href="#" class="suba">Onze mensen</a></li> <li><a href="#" class="suba">Werkzijze</a></li> </ul> </li> <li> <a href="vervolg3.html">Disciplines</a> <ul class="submenu"> <li><a href="vervolg.html" class="suba">Klimaatbeheersing</a></li> <li><a href="#" class="suba">Elektrotechniek</a></li> <li><a href="#" class="suba">Sanitaire techniek</a></li> <li><a href="#" class="suba">Energiebesparingstechniek</a></li> <li><a href="#" class="suba">Bouwfysica en geluid</a></li> <li><a href="#" class="suba">Diensten energiebesparing</a></li> </ul> </li> <li> <a href="#">Expertise</a> <ul class="submenu"> <li><a href="#" class="suba">Woningbouw & Utiliteit</a></li> <li><a href="#" class="suba">Zorg & Welzijn</a></li> <li><a href="#" class="suba">Milieu & Energie</a></li> <li><a href="#" class="suba">Beheer & Onderhoud</a></li> <li><a href="#" class="suba">EPA & EPC</a></li> <li><a href="#" class="suba">Legionella beheersing</a></li> </ul> </li> <li> <a href="#">Contact</a> <ul class="submenu"> <li><a href="#" class="suba">Adres & route</a></li> <li><a href="#" class="suba">Werken bij</a></li> </ul> </li> </ul> </div> The javascript: Code: <script type="text/javascript"> var ddmenuitem = 0; function jsddm_open() { jsddm_close(); ddmenuitem = $(this).find('ul.submenu').css('display', 'block'); } function jsddm_close() { if(ddmenuitem) ddmenuitem.css('display', 'none'); } $(document).ready(function() { $('#topnav > ul > li').bind('click', jsddm_open) $('#topnav ul li a.suba').click(function(e){ if ($(this).attr('class') != 'active'){ $('#topnav ul li a.suba').removeClass('active'); $(this).addClass('active'); } }); $("ul.submenu > li > a").each(function () { var currentURL = document.location.href; var thisURL = $(this).attr("href"); if (currentURL.indexOf(thisURL) != -1) { $(this).parents("ul.submenu").css('display', 'block'); } }); $('a').each(function () { var currentURL = document.location.href; var thisURL = $(this).attr('href'); if (currentURL = thisURL) { $(this).parents('ul.submenu').css('display', 'block'); } // else { // $(this).parents('ul.submenu').css('display', 'none'); // } }); }); </script> And the css: Code: #topnav ul { list-style: none; padding: 0; margin: 0; } #topnav ul li { float: left; margin: 0; padding: 0; } #topnav ul li a { padding: 5px 15px; color: #00537F; text-decoration: none; display: block; font-weight: bold; } #topnav ul li a:link { color: #FFF; text-decoration: none; } #topnav ul li a:visited { color: #FFF; text-decoration: none; } #topnav ul li a:hover { color: #FFF; text-decoration: underline; } #topnav ul li a.active { text-decoration: underline; color: #FFF; } /*#topnav ul li:hover .submenu { display:block; }*/ #topnav ul li ul.submenu { float: left; padding: 4px 0; position: absolute; left: 0; top: 24px; display: none; background: #e0e0e0; color: #00537F; } #topnav ul li ul.submenu a { display: inline; color: #00537F; padding: 4px 8px; } #topnav ul li ul.submenu li { border-right-width: 1px; border-right-style: solid; border-right-color: #00537F; } #topnav ul li ul.submenu li:last-child { border-right-style: none; } #topnav ul li ul.submenu a:link { color: #00537F; } #topnav ul li ul.submenu a:visited { color: #00537F; } #topnav ul li ul.submenu a:hover { text-decoration: underline; color: #00537F; } #topnav ul li ul.submenu li.active { text-decoration: underline; color: #00537F; } #topnav ul li ul.submenu a.active { text-decoration: underline; color: #00537F; } Hope I explained it clear. Thanks for any help. Hi Im trying to creat a website so when the small image is rolled over a new page opens in the frame ( called main) i will upload it now to http://www.e-z-host.com/GZ/ all help apricated ! at the momment you have to click to open the page in the main frame. Hi guys, As a relative newcomer to Javascript this is killing me! Maybe someone can help... I am trying to put an image on the front page of my website that changes to one of two random images on mouseover. This part was easy, and has been done (I got the code from http://www.joemaller.com/javascript/randomroll.shtml). But what I am finding difficult is to make each image link to a different page. For example, if the user mouseovers the main image and sees the 'thumbs up' image, then clicks on it, they should be taken to the 'thumbs up' page. And if the user mouseovers the main image and sees the 'thumbs down' image, then clicks on it, they should be taken to the 'thumbs down' page. The site is he www.uninvitedcritic.com I think using 2 arrays is the way to go, but am not sure. Any help would be appreciated! Hi there, I have a menu with 4 links and 4 images associated with them. By default, the image from link 1 is displayed on the page. I would like to change the image with its corresponding one, each time i mouseover one of the other three links. I'm trying to make the following code work unsuccesfully, i might be missing something. Any help will be appreciated. In the <head> section i have this: <script type="text/javascript"> img1 = new Image(); img1.src = "images/party/party.jpg"; img2 = new Image(); img2.src = "images/party/icecream.jpg"; img3 = new Image(); img3.src = "images/party/juice.jpg"; img4 = new Image(); img4.src = "images/party/videogames.jpg"; function change(num){ document.images["linkpic"].src = "img" + num } </script> </head> In the <body> i have: That's my default image <table> <tr> <td width="100"> <img src="images/party/balloon1.jpg" name="linkpic"> </td> <td width="260" valign="top" align="left"> <table> <tr><td><a href="Party1.html" onmouseover="change('1')">Party and Fun</a></td></tr> <tr><td><a href="Party2.html" onmouseover="change('2')">Icecream </a></td></tr> <tr><td><a href="Party3.html" onmouseover="change('3')">Juice </a></td></tr> <tr><td><a href="Party4.html" onmouseover="change('4')">Video Games </a></td></tr> </table> </tr> </table> </body> I would like when i point to Icecream, the picture on the left to change to the Icecream picture and so on. Any hints and help are appreciated! Thanks! Hello there. I'm using Joomla 1.5 and VirtueMart for my e-shop. I've also installed a virtuemart template which loads mootools. Well in my virtuemart product detail pages, if you click the main image to make it enlarged using IE8 it will not open and return a JS error instead (found it using Firebug): http://goo.gl/6lQCV Code: Message: 'closeButton' is null or not an object Line: 21 Char: 63 Code: 0 URI: http://www.xxxxx.xxx/media/system/js/mootools.js I'm not sure but I think that if I fix the JS errors on these pages the problem will be solved and the images will open normally. Note that on all other browsers it works fine (Firefox, Chrome, Safari, IE9). The page returns some other errors too but they're the whole time there. I think there's a conflict caused by all the JS libraries loaded by my Plugins (System - RokBox & YOOeffects), Joomla template, VirtueMart & VirtueMart template (jquery and mootools are both loaded). Thanks in advance Hi, I used this on-click changeable background code for my website: http://www.codingforums.com/showthread.php?t=136821 And now I have the same question as the original poster: is there any way to get it so that the chosen background stays put even if the page is refreshed or navigated away from? Or is it not possible because all my pages are separate files? website is: http://mintymix.com/ I hope it's ok to post here, the other thread is from 2008. Thanks for reading =) *edit* Ah, I'm kind of figuring that javascript doesn't work like that. If it won't work, is there any other type of coding I may use to achieve this? I have a php page which uses the following javascript code to open another page (The users profile page) and alos carry over the userID (dUid) Code: var userProfileUrl = chatProfileUrl+dUid.replace(/_/gi,""); document.getElementById('userdetails').innerHTML += "<span class='userinfo' onClick=\"window.open('"+userProfileUrl+"','"+dUid+"')\"><img id='profile' style='cursor:pointer;vertical-align:middle;padding-top:4px;' src=images/zoom.png> View Profile</span></br>"; I wanted to add to the menu another image link so I copied the same coding, but I do not know where to place the URL target that I want opened. I know I want the userID (dUid) also to follow this link as well. If I want the coding below to act in the same manner as the coding above, but instead open a page called /gift.php, where do I set the Url? Code: document.getElementById('userdetails').innerHTML += "<span class='userinfo' onClick=\"window.open('"+userProfileUrl+"','"+dUid+"')\"><img id='profile' style='cursor:pointer;vertical-align:middle;padding-top:4px;' src=images/gift.png> Send Gift</span></br>"; Hi, I mainly do PHP/MySQL coding, but I wanted to add this Javascript Accordion Menu to my site: Javascript And CSS Tutorial - Accordion Menus | Switch on the Code It works fine, but I was wondering if there was a simple way to modify the code so that the currently open menu stays open from page to page instead of closing upon each page reload? Thanks for the help, --Anamaniac Hi, I am working with the Cut & Paste JavaScript Slideshow which you can find on http://javascriptkit.com/script/script2/jsslide.shtml . The images are linked to a page on the Internet (click on image1 to go to "page1", click on image2 to go to "page2", etc.) which is a nice feature! However, the link opens in a new window. Could anyone tell me what I have to do to 'force' the link to open in the same window (target="_self")? Thank you for your help! I really appreciate it. WWWolf - Belgium Hello I'm a beginner when it comes to javascript. I found a nice script that did what I wanted, which was have 3 "buttons" that on hover change a different image to the side of them. However, I also would like the button that if clicked to go to a section of the website - so an internal link. I was slightly confused when reading that to have a link in javascript isn't good practice. How could I achieve this? I would really appreciate any help, thank you below is the code Code: <script language="JavaScript" type="text/JavaScript"> <!-- function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> </head> <body bgcolor="FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('information-white-alt.png','training-quote.png','training-white-alt.png','consultancy-quote.png','information-white-alt.png','information-quote.png')"> <table width="350" border="0" cellspacing="0" cellpadding="0"> <tr> <td><a href="javascript:;" onMouseOver="MM_swapImage('b1up','','information-white-alt.png','biganchor','','information-quote.png',1)" onMouseOut="MM_swapImgRestore()"><img src="information-white.png" name="b1up" width="270" height="74" border="0" id="b1up"></a></td> <td rowspan="3"><div align="center"><img src="home-statement.png" name="biganchor" width="500" height="222" id="biganchor"></div></td> </tr> <tr> <td><a href="javascript:;" onMouseOver="MM_swapImage('biganchor','','training-quote.png','b2up','','training-white-alt.png',1)" onMouseOut="MM_swapImgRestore()"><img src="training-white.png" name="b2up" width="270" height="74" border="0" id="b2up"></a></td> </tr> <tr> <td><a href="javascript:;" onMouseOver="MM_swapImage('biganchor','','consultancy-quote.png','b3up','','information-white-alt.png',1)" onMouseOut="MM_swapImgRestore()"><img src="information-white.png" name="b3up" width="270" height="74" border="0" id="b3up"></a></td> </tr> </table> Hi people ! I went to this page: http://www.javascriptkit.com/script/....shtml#current and I applied that script to my website, everything work perfectly. I only have a question about it: * What should I add to the code to avoid the sound activate even when I'm hovering over the margin of the image? * Would it be possible that the sound activate only when the mouse is hovered over the image and not the margin as well ? * Is the only solution; to insert every image in their own div and then letting the div handle the margin? this is the site www.blackbandanamovement.com the images I'm talking about are in the footer. thanks in advance I got this javascript Click sound effect to work - http://www.javascriptkit.com/script/...oundlink.shtml My question is how do I make it work on my iphone4 ? I tested the above site on my phone and there is no audio when I tap the screen. The html5 <audio> seems to work with my mobile device on this site - http://css-tricks.com/examples/SoundOnHover/ I am new to javascript thx Hi all, I am using the following script posted on this site: http://www.javascriptkit.com/script/...oundlink.shtml It works great, but I want to extend this script and mute the sound using a checkbox. This checkbox has the id: sound. If checked, I want to hear the sounds, when unchecked, no sounds should be heard. This is the code I currently have for the checkbox: Code: function playSound() { if (document.getElementById('sound').checked){ -something needs to be added here to make it work?- } } Anyone have an idea how to make this work? Many thanks Hello, and thanks for any help. I'm developing a site to include a map of schools (http://www.fcsoablues.net/map.asp). I'm creating hotspot links to googlemaps for each school (in a new browser window). I've got that much working okay. My problem is, I'd like to include popups for each hotspot that, on mouseover, show the name of the school. The popup should close on mouseoff. Without this, users only see the map full of school icons, and it's difficult to know which school is which. Ideally, the popup should follow the cursor (not a must, though). I've included the BODY of the code I'm using below. Code: <body> <img src="/FCSOA_IMAGES/Foothill-Citrus area map.jpg" width="1600" height="826" border="0" usemap="#Map" /> <map name="Map" id="Map"> <area shape="rect" coords="1169,166,1196,194" href="http://maps.google.com/maps?rlz=1C1AVSX_enUS420US420&um=1&ie=UTF-8&q=alta+loma+high+school&fb=1&gl=us&hq=alta+loma+high+school&hnear=0x80c32def799fa121:0x5209947000caa933,Pomona,+CA&ei=6x40T_WtDMaU2AXbtPnzAQ&sa=X&oi=local_group&ct=image&ved=0CAgQtgM&iwloc=cids:11113758998891877583" target="_new" alt="Alta Loma High School" /> <area shape="rect" coords="776,299,803,324" href="http://maps.google.com/maps?rlz=1C1AVSX_enUS420US420&um=1&ie=UTF-8&q=claremont+high+school&fb=1&gl=us&hq=claremont+high+school&hnear=claremont+high+school&cid=0,0,7887364383841814220&ei=Mh80T-LLBanm2QX4s72RAg&sa=X&oi=local_result&ct=image&ved=0CA8Q_BI" target="_new" alt="Claremont High School" /> <area shape="rect" coords="523,262,548,289" href="http://maps.google.com/maps?rlz=1C1AVSX_enUS420US420&um=1&ie=UTF-8&q=San+Dimas+High+School&fb=1&gl=us&hq=San+Dimas+High+School&hnear=San+Dimas+High+School&cid=0,0,9099100455580750144&ei=Wx80T7X9D6O-2gXU9YGeAg&sa=X&oi=local_result&ct=image&ved=0CA8Q_BI" target="_new" alt="San Dimas High School" /> </map> </body> Hi all, I am looking for this javascript, script that when I click a specific link 1. Opens a new window 2. Specifies a specitic window title 3. Load an image on it (there will be no text but only an image shown) Could you please help me understand how I do that? Regards Alex Hello How to Make a Html Form Shows Up when Visitor Click a Link .. I have seen Site where you want to add Message u click Link then the Form under the Link Shows Up .. it stays Hidden unless Visitor Click Link 'Send Message' . It seems done by Java but How .. Hi I wrote following code for the purpose to single right click to open new window, while left click would open another window. It works for IE but does not work for Firefox. Please help. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US|zh-Hans|zh-Hant"> <head> <title>Javascript Question</title> <META NAME="LANGUAGE" CONTENT="en"> <META NAME="DOCUMENTCOUNTRYCODE" CONTENT="us"> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=GB18030"> <script language='Javascript' type='text/javascript'> var rightClick = false; window.document.oncontextmenu = new Function("return false"); window.document.onmouseup = mouseUp; function mouseUp(e) { if (!e) var e = window.event; if (e.which) rightClick = (e.which == 3) else if (e.button) rightClick = (e.button == 2); if (rightClick) window.open('http://www.yahoo.com/'); } </script> </head> <body> <a href="#" onclick="window.open('http://www.google.com/')" onmouseup>Open New Window</a> </body> </html> Hi, I'm having trouble figuring out why my image is disappearing when the user clicks on the arrow image to expand text for viewing. The arrow image only disappears if the link text is is more than one line. It remains if the link is only one line of text. Here is the code: HTML code: Code: <div class="ws-webpart> <div class="hidecat1"></div> <div class="hidecat1"> <!--This comment line added please dont remove this comment line --> <a class="hidecat2" id="za0.91" onclick="showHide('a0.91')" href="javascript:void(0)">Lorem ipsum dolor sit amet</a> </div> <div style="display:none;" id="a0.91"> <!--This comment line added please dont remove this comment line --> <div class="hideqst1"> <a id="sb0.913.92" class="hideqst2" onclick="showHide('b0.913.92')" href="javascript:void(0)"> Sed lectus lectus, varius quis vestibulum non, molestie vel est. Integer enim quam, elementum vel ornare non, egestas non augue. Ut varius vulputate mi, </a> </div> <div style="display:none;" id="b0.913.92"> <!--This comment line added please dont remove this comment line --> <div class="hideAns"> <p>Fusce suscipit tempus magna eget eleifend. Ut lacinia, turpis ac tempus euismod, nulla ipsum vehicula sem, et laoreet augue nunc in neque. Maecenas porttitor lacinia risus, et rhoncus felis vestibulum eget. Sed nec turpis nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; In fringilla mollis leo sed auctor. </p> </div> </div> <div class="hideqst1"> <a id="sb0.9134.65" class="hideqst2" onclick="showHide('b0.9134.65')" href="javascript:void(0)"> Integer non urna vel ligula interdum?</a> </div> <div style="display:none;" id="b0.9134.65"> <!--This comment line added please dont remove this comment line--> <div class="hideAns"> <p>Suspendisse pretium gravida tortor, id blandit elit hendrerit porttitor. Mauris at purus id neque mollis placerat vitae in tortor. Morbi porta tincidunt sagittis. Nam quis augue justo, id euismod nisl.</p> <p>• Donec sit amet urna felis. Praesent at erat ligula, eget porttitor diam.<br> • Quisque quis sapien leo. Proin sit amet sem et lectus gravida iaculis a non turpis. Vivamus at metus quis odio mattis </p> </div> </div> </div> CSS code: Code: div.ws-webpart{margin-bottom:15px;clear:both;} .ws-webpart.hidecat1{padding-top:7px;} .ws-webpart.hidecat2{padding-left:2.2ex;color:#000;font-weight:700;text-decoration:underline;background:url(../images/layout/link_arrow.gif) no-repeat 0 3px;} .ws-webpart.hidecat3{padding-left:2.2ex;color:#000;font-weight:700;text-decoration:none;background:url(../images/layout/link_arrow_down.gif) no-repeat 0 3px;} .ws-webpart.collapseqst1{padding-top:7px;padding-left:2.2ex;} .ws-webpart.hideqst2{padding-left:2.2ex;color:#7C902C;padding-right:0;background:url(../images/layout/link_arrow.gif) no-repeat 0 3px; zoom:1;} .ws-webpart.hideqst3{padding-left:2.2ex;color:#7C902C;padding-right:0;background:url(../images/layout/link_arrow_down.gif) no-repeat 0 3px;} .ws-webpart.hideAns{color:#000;padding-left:4.4ex;padding-right:1.5ex;padding-top:7px;} Javascript code: Code: <script language="javascript" > // Function for Collapsible Link function showHide(ID) { if (document.getElementById(ID).style.display == "block"){ document.getElementById(ID).style.display = "none"; if(ID.charAt(0)=="a"){ document.getElementById("z"+ID).className="hidecat2"; } if(ID.charAt(0)=="b"){ document.getElementById("s"+ID).className="hideqst2"; } } else { document.getElementById(ID).style.display = "block"; if(ID.charAt(0)=="a"){ document.getElementById("z"+ID).className="hidecat3"; } if(ID.charAt(0)=="b"){ document.getElementById("s"+ID).className="hideqst3"; } } } </script> I have attached the images. Thanks in advance Hi I have created the following effects on the images seen here http://techavid.com/design/test3.html . You see when you hover and then click on each image, they go from grey to color. When you click on one - the others go grey and the one clicked remains color. That's cool, but now I need the text 1st: Sun for example to display and hide along with its graphic button. The word "Sun," is a link that needs to link out to a URL so it has to be separated from the image effect code. Here code I have now.... Code: <style type="text/css" media="screen"> #wrapper { background: url('_assets/images/sun-inactive.p') no-repeat #777eee; width: 470px; margin: 0 auto; } a#sun{ background: url('_assets/images/sun-inactive.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; float: left; } a#sun:hover, a#sun.active { background: url('_assets/images/sun.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; } a#plane { background: url('_assets/images/plane-inactive.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; float: left; } a#plane:hover, a#plane.active { background: url('_assets/images/plane.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; } a#nano { background: url('_assets/images/nano-inactive.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; float: left; } a#nano:hover, a#nano.active { background: url('_assets/images/nano.png') no-repeat; width: 107px; height: 78px; display:block; padding: 20px 10px; } #popuptext { float: left; margin: -30px 0 0 0; padding: 0 0 0 0px; font-size: 11px; } #popuptext a { color: #ff6600; padding: 0 30px; } </style> </head> <body> <div id="wrapper"> <div id="navigation"> <a id="sun" href="#"></a> <a id="plane" href="#"></a> <a id="nano" href="#"></a> </div> <div style="clear:both"></div> <div id="popuptext">1st: <a href="#">Sun</a> 2nd: <a href="#">Airplane</a> 3rd: <a href="#">Nano</a> </div> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // target each link in the navigation div $('#navigation a').click(function() { // link that you clicked clicked = $(this).attr('id'); // make sure that all the others are not active // except for the clicked one $('#navigation a').each(function() { if ($(this).attr('id') == clicked) { $(this).addClass('active'); } else { $(this).removeClass('active'); } }); // prevent the default link action return false; }); }); </script> What jquery or javascript code do I need to do this? thanks, chaser I have gotten my script to do exactly what I want it to do with one exception. I have some thumbnail images that people can mouse over and the actual image is 100px by 75px. That is what I use for my thumbnail and they reside in www.website.com/images/thumbs/image1.jpg. I have the large version of the image that resides in www.website.com/images/image1.jpg. Its actual size is 640px by 480. When I mouse over my thumbnail, I don't want the thumbnail to appear for the larger image, I want the large image to appear instead? Let me know if you need ellaboration. Any help would be great! Thank you. Javascript Code: <script language="JavaScript"> function Change_Big_One(thumb){ document.getElementById('BigOne').src=thumb.src.replace("_th","") } </script> HTML THUMBNAIL Code: <div><img src="https://www.website.com/images/thumbs/image1.jpg" class="thumb" onMouseOver="Change_Big_One(this)"></div> HTML LARGER IMAGE Code: <div><img src="" id="BigOne"></div> |