sparkles2.png

Search - Hidden Until Icon Clicked

 

This code will make the search bar in the header completely hidden until the magnifying glass icon is clicked.

 

How to use the Effect

Firstly, create a 'Menu' which has the magnifying glass icon in it. Add this into your header.
Secondly, simply copy the below code and paste it into your 'Footer Code' of the 'Tracking' area of Blocklab, hit save and publish.

 

JS

<script>
$("#blocklab-header .fa.fa-search").on("click", function(e) {
    e.preventDefault();
    $(this).hide().closest('ul').prepend('<li><form class=form-inline action=/search method=get style=" position: relative; top: 7px; "><div class=input-group><input type=text name=q class=form-control placeholder=Search><span class=input-group-btn> <button class="btn btn-default" type=submit><i class="fa fa-search"></i></button></span></div></form></li>');
});
</script>

(Find out how to/where to add JS code in this tutorialHOW TO ADD JS CODE