• Resolved jubilo

    (@jubilo)


    We have a usability problem, several users complained about the product search engine.

    In the search (this one): https://snipboard.io/NfgW9s.jpg

    When the user scrolls directly from here: https://snipboard.io/z6OCWI.jpg
    The search box disappears.

    Consider it a minor problem, but on the site where we installed the plugin, all users who use this method of scrolling complained that the search box did not work or “disappeared”.

    Is there a way to avoid this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter jubilo

    (@jubilo)

    Hello, is there a solution for this? What do you recommend?

    Plugin Support Kris

    (@c0nst)

    Hi @jubilo

    You can try this code snippet. It will make the search results and details panel visible as long as the input has the entered phrase. This should solve the problem you mentioned.

    <?php add_action( 'wp_footer', function() { ?>
    	<script type="text/javascript">
    		(function ($) {
    			$(document).ajaxSuccess(function (event, request, settings) {
    				fibosearch_visibility(event, request, settings);
    			});
    
    			$('.dgwt-wcas-search-input').on( 'input', null, null, function() {
    				if ( $(this).val().length < 3 ) {
    					jQuery('html').removeClass('fibosearch-visible');
    				}
    			});
    
    			let timeout;
    
    			$('.dgwt-wcas-search-wrapp').on( 'click', '.dgwt-wcas-preloader', function(e) {
    
    				if ( timeout !== undefined ) {
    					clearTimeout( timeout );
    				}
    
    				timeout = setTimeout(function() {
    					$('html').removeClass('fibosearch-visible');
    				}, 300 );
    			});
    
    		}(jQuery));
    
    		function fibosearch_visibility(event, request, settings) {
    			if (typeof settings.url == 'string' && new RegExp('dgwt_wcas_ajax_search').test(settings.url)) {
    				if ( $('.dgwt-wcas-search-wrapp' ).hasClass('dgwt-wcas-search-filled', 'dgwt-wcas-active') ) {
    					$('html').addClass('fibosearch-visible');
    				} else {
    					$('html').removeClass('fibosearch-visible');
    				}
    			}
    		}
    	</script>
    	<style type="text/css">
    		.fibosearch-visible .dgwt-wcas-suggestions-wrapp,
    		.fibosearch-visible .dgwt-wcas-details-wrapp{
    			display: block !important;
    		}
    
    		.fibosearch-visible .dgwt-wcas-details-wrapp,
    		.fibosearch-visible .dgwt-wcas-suggestions-wrapp {
    			border-color: #fff;
    			padding-top: 10px;
    			padding-bottom: 10px;
    		}
    
    		.fibosearch-visible .dgwt-wcas-details-inner,
    		.fibosearch-visible .dgwt-wcas-suggestions-wrapp > .dgwt-wcas-suggestion {
    			padding-left: 20px;
    			padding-right: 20px;
    		}
    	</style>
    <?php }, 9999 );

    You have two ways to add this code to your theme:
    1. Open the functions.php in your child theme and add the code at the end.
    2. or install the Code Snippets plugin and apply this code as a snippet.

    Regards,
    Kris

    Thread Starter jubilo

    (@jubilo)

    Excellent!! Works perfeclty!!!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Search box disappears when scrolling’ is closed to new replies.