Brooklyn doesn't have a search box by default and adding one to the header somewhat disrupts the aesthetic of the theme. Instead of adding just an icon linking to the search page, why not adding a modal using the already built in popup plugin?
Did you see that fade in?! It's actually very smooth IRL.
Step 1. It's built into the theme now! Just uncomment the search icon around line 286.
Step 2. On the next line, assign search_modal to true.
Step 3. Receive hella praise from your super happy merchant.
Feel free to checkout the rest of the gist if you're curious.
- Add the code below before the
</body>
tag. This will be hidden by default given the mfp-hide class.
<div id="search_popup" class="mfp-hide">
{% include 'search-bar' %}
</div>
- Uncomment the search icon around line 280.
- Add
mfp target'data-mfp-src="#search_popup"
and a class calledjs-search
to the link tag.
- Remove conditional statement for loading in magnific-popup.min.js since it now needs to be loaded on every page.
See file below.
- Finally, add a function to theme.js
// add this to the theme.init function
theme.searchModal();
// add this function right above the productImageZoom function around line 238
theme.searchModal = function() {
$('.js-search').magnificPopup({
type: 'inline',
closeOnContentClick: false,
closeOnBgClick: true,
closeBtnInside: false,
mainClass: 'mfp-fade',
midClick: true
});
}