Forums Forums Search & Filter Pro Hide Search Results on Page Load

Viewing 4 posts - 1 through 4 (of 4 total)
  • Anonymous
    #17778

    Hey Ross,

    I’m wanting to hide the results on initial page load, but don’t see a setting for that. I’m attempting to do it with AJAX. When I set the ‘.search-filter-results’ to display: none, they hide. However, when target the first result (it’s a placeholder – “All States”) as a check to see if it’s selected or not, I can’t seem to get the results show if it’s not. Does my jQuery look sound?

    
    jQuery(document).bind('ready ajaxComplete', function() {
    $j('.search-filter-results').css('display','none');
    if (!$j('#search-filter-form-205 .postform option[value="0"]')) {
    $j('#search-filter-form-205 .search-filter-results').css('display','block');
    }
    });
    

    URL is http://kevinobrienstudio.dreamhosters.com/two-filters/

    Ross Moderator
    #17780

    Check the first question in the FAQs –

    http://www.designsandcode.com/wordpress-plugins/search-filter-pro/faqs/

    This has the code to do what you need..

    I would start by hiding the results using CSS

    .search-filter-results
    {
        display:none;
    }

    The use the ajax finish hook from the FAQs:

    $(".searchandfilter").on("sf:ajaxfinish",function(e, x){
       //show my results here
        console.log(e);
        console.log(x);
    });

    Thanks

    Anonymous
    #17782

    When you say “//show my results here,” do you mean I should include a call to display results as I was in the code sample I sent?

    
    $j('#search-filter-form-205 .search-filter-results').css('display','block');
    
    Ross Moderator
    #18013

    Hey Dan

    I’m not sure what $j is, possibly an alias to jQuery?

    Anyway, yeah you would need to add the javascript for showing your results again, something like:

    $('.search-filter-results').show();

    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)