/* This is the shorcode of WooCommerce Product Search*/
<?php echo do_shortcode('[woocommerce_product_search title="woocommerce product search"
widget_type="woocommerce product search" dynamic_focus="yes" placeholder="Search.." submit_button_label="ok" submit_button="yes"]');
?>
/* jQuery*/
jQuery(document).ready(function($) {
$(document).mouseup(function (e)
{
var container = $(".product-search-results"); //.. The default class of search results
if (!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.hide(); //.. hide the container
}
});
$(window).keyup(function(event) {
if(event.which === 27) {
$(".product-search-results").hide();
}
});
});
"WooCommerce Product Search" is a useful and great plugin, but until does now support two important features.
- Close the search results when the user click outside the form.
- Hide the search results when the user press "ESC" button.
- Close the search results when the user click outside the form.
- Hide the search results when the user press "ESC" button.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.