Skip to content

Instantly share code, notes, and snippets.

@sirusdas
Last active July 30, 2016 10:03
Show Gist options
  • Save sirusdas/f299cdec64343e6822ad54627265ac94 to your computer and use it in GitHub Desktop.
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 -
<!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>
@sirusdas
Copy link
Author

Make Block just add
+ Your content
Redesign Css and what ever you can and you can use it to create infinite blocks in a page. Enjoy 👍

@sirusdas
Copy link
Author

For Wordpress Must Have Apps

  1. http://urbangiraffe.com/plugins/disable-wpautop/
  2. Quicktag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment