How to add a Spoiler or Hide/Show Button for Blogger

If you want to post some content. This effect is known as spoiler or hide/show effect. This effect displays a button with text, clicking it will expand the content and on clicking it again will hide the content. It uses a simple script and you can use it anywhere on your blog. You can hide whatever you want a content like an image, code, text etc. For example (show/hide button) like this :


 Adding this button to a blogger post is very easy,just follow the instructions :
  • Copy the below code 
<div id="spoiler" style="display:none">
  YOUR HIDDEN CONTENT HERE
</div>
<button title="Click to Show/Hide Content" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">Show/Hide</button>
  • In the blogger post editor click on HTML tab
  • Paste it where you want to add this button.
*NOTE :
Replace YOUR HIDDEN CONTENT HERE with the content that you want to show on click
You can also replace button text i.e Show/Hide
So easy, right? Good luck!

If you have any question, please leave the comment below!

0 comments: