April 12, 200818 yr Help! I reckon this could be done in CSS (may be PHP) but I can't find it in any google searches! I would like to know how I could script my navigation so that if you hover over the "hover button", some text (probs in a different div) will change to say "Home". Can it be done? Ofc i'd then have it say "Contact Me" for the contact button etc. Thanks guys! Russ
April 12, 200818 yr Help! I reckon this could be done in CSS (may be PHP) but I can't find it in any google searches! I would like to know how I could script my navigation so that if you hover over the "hover button", some text (probs in a different div) will change to say "Home". Can it be done? Ofc i'd then have it say "Contact Me" for the contact button etc. Thanks guys! Russ css rollovers will definately change the text in the current hover position, but it will be fixed font size as you'll be loading a new gif / graphic / background. not sure how to change text elsewhere on the page or change text in hover location using css, might well require some javascript.
April 12, 200818 yr almost 100% definitely require some javascript for that one. give the other forum sections a shout
April 12, 200818 yr yeah this can be done with css - set up a div with text in for each hover button - have each of these div have a display:none until you hover over their related hover button - in which case the related div is display:block need to see where you're up to before giving a fuller answer but sounds do-able
April 12, 200818 yr Author Okay so in the hover command for each button how would I write the command to change the property of the appropriate text's div? If it's easier, womble, could you add me on msn (russbish@hotmail.co.uk) and we could go through it together? Thanks so much Russ
April 13, 200818 yr Author Helpp! Here's the layout. http://www.imagebam.com/image/2162cb4985169 I would like to make it so that when you hover over one of those buttons in the top left, the text in the box to the right of it will change. After speaking to php_penguin, I've found it will either be some very complicated css (not wanted) or some semi-complicated js - so i'll take that please If anyone can help - please do! Thanks guys, Russ
April 13, 200818 yr I would go for the more complicated css. If you use the semi-complicated javascript, many people will not see the effect because they have scripting turned off. There are two ways to do it with CSS, one is to have several elements and use the visibility: none, visibility: visible properties to show and hide them. The other way is to have a background image which has all of the different texts in it, one below the other, and move the image around with absolute positioning. This explains how to do the latter: http://www.webdesignerforum.co.uk/index.php?showtopic=270
April 13, 200818 yr Eris is right. If you check out the bit of css that Rob H came up with on this thread, it should be fairly straightforward to adapt it to your needs.
April 13, 200818 yr Looks like I'm set thanks gents ! I'm a lady *just merged and moved this thread as I realised it was a duplicate*
April 14, 200818 yr Author Sorry guys I'm really confused with this > I don't understand how you can add in one div's hoverstate to move the background image of another? Could someone please help me with this step by step? Very amateur with css.
April 16, 200818 yr Ok, good point changing one elements background image from another's hover is not possible with css. There are some funky ways you could do it, by setting it to be the background element of the element you are hovering over, but moving the background to the position you want. Otherwise if you want them to remain separate elements you will need a little bit of javascript. Using onmouseover (The javascript equivalent of hover). something like: document.getElementById("infobox").backgroundImage="whatever"; or have a set of classes for the infobox (which is the element the image is going to be in) so .home, .contact etc, each with the correct background image and use something like: document.getElementById("infobox").class="home"; For absolute cross browser compatibility use this function to do the getElementById bit: var DHTML = (document.getElementById || document.all || document.layers); function getObj(name) { if (document.getElementById) { this.obj = document.getElementById(name); this.style = document.getElementById(name).style; } else if (document.all) { this.obj = document.all[name]; this.style = document.all[name].style; } else if (document.layers) { this.obj = document.layers[name]; this.style = document.layers[name]; } } then create a function like function imageChange("element"){ if (!DHTML) return; var x = new getObj("infobox"); x.class = element; //element contains the class name. x.className = element; //think you need this to make it work in all browsers? } and in your links you would have something like: <a href="home.html" title="home" onmouseover="java script:imageChange('home')"> Thats not tested or exact but is the right kind of lines.
April 16, 200818 yr Author Thanks soo much for your help ErisDS, I'll try my best to incorporate this. Wish I knew of a website already doing this so I could take a look at how they've done it.
Create an account or sign in to comment