javascript - Move selection nipple to selected div ID on link click -


i working on website features many links on same page:

http://www.alexanderlozada.com

to let user know item viewing, i'd implement small triangle points @ selected item.

example:

enter image description here

how go doing without making each link separate page?

sample of link working with- (i have keep current href , rel)

<a class="grey show_hide" href="#" rel="#projects" >    projects </a> 

in cases done using pseudo elements :before and/or :after (read full article)

css:

/* creates triangle */ .selected:after {    content:"";    display:block; /* reduce damage in ff3.0 */    position:absolute;    bottom:-2px;    left:50%;    width:0;    margin-left:-10px;    border-width:0px 15px 15px;    border-style:solid;    border-color:white transparent; }    div.links {     display: inline-block;     position:relative; // must have position triangle propery     width: 25%;     height: 45px; // adjust height fit menu     float: left;     text-align: center;     font-size: 24px;     padding-top: 10px; } 

jquery:

$(function(){     $('.show_hide').click(function(){         $('div.links').removeclass('selected'); // remove other 'selected' links         $(this).parent().addclass('selected'); // sets current .links selected     }); }); 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -