Forums Forums Search & Filter Pro Scroll to filter on load?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Trevor
    #249406

    The settings we have for ‘scroll to’ are here in the form design, on the Display Results settings tab in the Ajax section:

    https://www.screencast.com/t/ckyArmLs

    Anonymous
    #249474

    Hey Trevor, thanks for the response. Yup—I have that all set up to scroll to the search form on ‘all’.

    My question is, if I go to the page using the ‘bookmarkable permalink’, is it possible to scroll to the search form as if I was using an anchor link?

    Matter of fact, I don’t even mind if it doesn’t scroll. Is there a setting to make the ‘bookmarkable permalink’ show the search form (or any other #) at the top of the window?

    Thanks again!

    Trevor
    #249481

    I guess all you would need to do is make one of the containing elements for the form has an ID and simply use that, maybe something like this:

    mysite.com/searchpage/#myid?_sf_s=hello

    Maybe? I am not sure if that would work though. You might have to set the page up with some form of JavaScript that scrolls the page down to the form.

    Anonymous
    #249493

    Thanks Trevor—unfortunately, that ID approach doesn’t seem to work. The window isn’t at the anchor AND it prevents the filter functionality.

    Has any JS wizards out there implemented a smart scripted approach?

    Trevor
    #249497

    I am not aware of any code snippets, but a search of Google gives me these articles:

    https://www.google.com/search?q=jquery+scroll+to+anchor+on+document+ready+site%3Astackoverflow.com

    Anonymous
    #249652

    Awesome, thanks for helping with that search query. I should have guessed you guys are great at searching and filtering:)

    Combining that with an if statement seems to be working well. Anyone needing a similar solution, please see below.

    
    <script>
    jQuery(document).ready(function () {
    	jQuery(window).load(function(){
    	    if (window.location.href.indexOf('?_sft_') > 0) {
    	    	
    	    	ele = scrollToElement(jQuery('form#search-filter-form-177'));
    	    	
    	    	function scrollToElement(ele) {
    	    	    jQuery(window).scrollTop(ele.offset().top).scrollLeft(ele.offset().left);
    	    	}
    	        
    	    }
    	});
    });
    </script>
    
    Trevor
    #249654

    Thanks for getting back to us and sharing that code with other users. I will close this thread for now.

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