May 26, 201115 yr Hey guys, I am not really a web designer... I know the basics of CSS and Java Script however, I am in need to make a website with some specific detail and I don't have a clue if I am on the right path. I have two main questions really: 1. on the chanel website: http://www.chanel.com/ When you hover over a link (e.g. Skincare or make up) the other links turn grey. I'm not sure if there is a specific roll over code to do this or is it more complex? 2. on the website: http://www.harbourgrand.com/hongkong/luxury-hotel-,default-en.html there is a main image in the middle of the page. on this image there is a bar which says 'luxury by the harbourside' when u click read more the bar slide up and more information appears. Im sure this can be achieved using Java Script, Jquery or something but I just do not know where I am meant to start or what to look for. I hope I have been clear and really hope that someone will be able to help me with this. many thanks =D
May 26, 201115 yr well the links are easy to do. Just set you hover state to change the text color.. #nav a{ color: #666; /*Grey before roll*/ } #nav a:hover { color: #fff; /*when rolled over, text color goes white*/ }
May 27, 201115 yr Hi Marzi, It's not only the matter of CSS, but the combination of JAVASCRIPT file too. Reply with your mail id..I will send you the files. it will help you to create a similar hover effect.. Regards Yuga.G
May 27, 201115 yr lets presume you have the following: <div id="mainmenu"> <a href="#">HOME</a> <a href="#">PRODUCTS</a> <a href="#">SERVICES</a> <a href="#">SUPPORT</a> <a href="#">CONTACT</a> </div> and we definitely decide that we need a javascript to handle your main menu effect. so we make: <script type="text/javascript"> mm = document.getElementById('mainmenu'); // define the mainmenu element mmLinks = mm.getElementsByTagName('a'); // get all links from main menu for (i=0;i<mmLink.length;i++){ mmLink[i].onmouseover = function(){ for (x=0;x<mmLink.length;x++) mmLink[x].style.color='#666'; // set all links to grey this.style.color='#FFF'; // selected link goes white } mmLink[i].onmouseout = function(){ for (x=0;x<mmLink.length;x++) mmLink[x].style.color='#FFF'; // all links goes white } } </script> this is a basic sample, easy to understand. it could be mastered tough... Edited May 27, 201115 yr by webworks
May 27, 201115 yr With the Chanel one, there's no need for javascript to get the effect in the main menu; you can do the same thing with CSS, inheritance & specificity. Imagine your colours are #ccc and #fff, and your menu is a <ul> #menu { overflow: auto; /* this is to give your menu height and allow it to take the hover state, inlining the list items is left as an exercise for the reader */ } #menu li a { color: #fff; } #menu:hover a { /* #menu:hover li a would probably work, but let's go for overkill */ color: #ccc; } #menu li a:hover { color: #fff; } Changing the images along with hover is just a matter of setting them as background to absolutely-positioned elements within the list items (make sure your list isn't relatively positioned so the absolute items take their position relative to the body or a relative wrapper) and changing the opacity on hover of the list elements. If you want them to fade in and out, use a CSS3 transition. I'd write that out for you too but I'm slightly drunk and I can never remember the browser-specific properties, but as a rule of thumb put the browser-specific stuff before the valid CSS so when a browswer supports the valid version it will take that as the last rule it recognises. Why yes, I AM the Drunken Master of CSS. Edited May 27, 201115 yr by Renaissance-Design
May 27, 201115 yr #menu:hover a { /* #menu:hover li a would probably work, but let's go for overkill */ color: #ccc; } Any other html element:hover besides <a> , would not be a valid IE6 css rule. We all know that ie6 is a big problem for us developers, either is css or js. thats why I choose the javascript code over the css div#menu:hover rule. I dont know about ie7, if someone tests this, please let us know. regards
May 28, 201115 yr Any other html element:hover besides <a> , would not be a valid IE6 css rule. Neither would the CSS3 necessary to get the background-image effects. I don't support IE6 any more; it's not a fair thing to charge my clients for when my time could be better spent improving the experience for users whose browsers aren't 10 years old and deprecated by Microsoft.
May 28, 201115 yr Neither would the CSS3 necessary to get the background-image effects. I don't support IE6 any more; it's not a fair thing to charge my clients for when my time could be better spent improving the experience for users whose browsers aren't 10 years old and deprecated by Microsoft. I don't support ie6 neither, and i cannot charge my clients for extra time spent fixing ie6 bugs, either css or javascript, that is my job as a developer. Also... there can be browsers even 20+ years old, if it is used, we must provide same quality in all browsers even for those 2-3% who still use ie6. PS. I charge per project / not per hour. thats the way it is here we better stop here and avoid going off topic. we provided good solutions for MarzImator, one based on pure css, and another based on javascript.
May 29, 201115 yr Author Hey thanks for the responses guys, I had managed to work out how to do the sliding menu bar using JQuery and it works a treat! However, the Links I still seem to not be doing something right... even with the help from webworks Code it does not seem to work as I want it. Would anyone be able to send me a demo file which I will be able to work out what exactly I am doing wrong?? Many Thanks Again Guys
May 29, 201115 yr ...there can be browsers even 20+ years old, if it is used, we must provide same quality in all browsers even for those 2-3% who still use ie6. No no no! Why should i, as a developer, ruin the experience of the users with updated browsers by using unnecessary or bloated code? By all means have graceful fall back for those Neanderthals (or companies) with such old browsers but never at the expense of those users who have a better browser.
May 30, 201115 yr Author I was able to sort out the first question, <div class="menu_box"> <ul class="menu_list"><li> <a href="roadtonowhere.html">Link</a></li> <li><a href="roadtonowhere.html">Link</a></li> <li><a href="roadtonowhere.html">Link</a></li> <li><a href="roadtonowhere.html">Link</a></li> </ul> ..menu_box { background-color:#000;}ul.menu_list a {color:#FFF;} ul.menu_list:hover a {color:#999;} ul.menu_list li a:hover {color:#FFF;} This works a treat!! Thanks again for your help guys =D Edited May 30, 201115 yr by MarzImator
Create an account or sign in to comment