Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :target {
- background-color: #ffa;
- }
- <div>
- <h1><a id="first">How can I...</a></h1>
- <h1><a id="second">...make this...</a></h1>
- <h1><a id="turd">Highlighted when....</a></h1>
- <h1><a id="furd">Visited by an...</a></h1>
- <h1><a id="earth">Anchor URL</a></h1>
- </div>
- var id=window.location.href.substring(window.location.href.lastIndexOf('/') + 1);
- $(id).css('background-color','red');
- var hash = window.location.hash;
- $('#'+hash).parent().css('background-color','red');
- $("h1").each(function(a,b){
- $(this).find('a').click(function(){
- console.log(this);
- $(this).css('color','#333399');
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement