Last active
August 29, 2015 14:16
-
-
Save cflove/55258840525d436fda3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<script src="js/jquery-1.11.2.min.js"></script> | |
</head> | |
<body> | |
<style> | |
li {list-style:none; float:left;margin-left:0; padding-left:0; border:1px solid red; padding:10px;} | |
div {border:1px solid red; clear:both; display:none} | |
</style> | |
<ul> | |
<li data-id="one" >About Us</li> | |
<li data-id="two">Home</li> | |
<li data-id="three">Contact</li> | |
</ul> | |
<div id="one">Hello. I'm one</div> | |
<div id="two">Hello. I'm two</div> | |
<div id="three">Hello. I'm three</div> | |
<script> | |
$('li').click( function() { | |
var a = $(this).attr('data-id') | |
$('div:visible').css('display','none') | |
$('#'+a).css('display','block') | |
} ) | |
$('li:eq(0)').click() | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment