Last active
July 30, 2016 10:03
-
-
Save sirusdas/f299cdec64343e6822ad54627265ac94 to your computer and use it in GitHub Desktop.
Show-Hide Blocks in Html using Jquery and exapand when you hit + and close when you hit -
This file contains hidden or 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> | |
<head> | |
<style> | |
sh{ | |
display: none; | |
} | |
.wpe-box .sh0{ | |
float: right; | |
position: relative; | |
cursor:pointer; | |
} | |
.wpe-box .sh2{ | |
float: right; | |
position: relative; | |
top: -45px; | |
cursor:pointer; | |
} | |
.wpe-box .sh1{ | |
float: right; | |
position: relative; | |
top: -49px; | |
cursor:pointer; | |
} | |
.wpe-box .sh3{ | |
float: right; | |
position: relative; | |
top: -42px; | |
cursor:pointer; | |
} | |
.wpe-box .sh4{ | |
float: right; | |
position: relative; | |
top: -35px; | |
cursor:pointer; | |
} | |
.wpe-box .sh5{ | |
float: right; | |
position: relative; | |
top: -32px; | |
cursor:pointer; | |
} | |
.wpe-box .sh6{ | |
float: right; | |
position: relative; | |
top: -32px; | |
cursor:pointer; | |
} | |
</style> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
//$("sh").hide(); | |
$(this).click(function(event){ | |
$(event.target).next("sh").toggle(); | |
if ($(event.target).html() == '+') { | |
$(event.target).html("-"); | |
} | |
else{ | |
if ($(event.target).html() == '-') { | |
$(event.target).html("+"); | |
} | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body class="ancestors"> | |
<div style="width:500px;"> | |
Details | |
<button>+</button> | |
<sh> | |
<p> Enjoy all the Details </p> | |
</sh> | |
</div> | |
<div style="width:500px;"> | |
Specs | |
<button>+</button> | |
<sh> | |
<p> And the Specification with innovation </p> | |
</sh> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Wordpress Must Have Apps