Not sure if this is a bit of a tall order, but what I'm looking to achieve is to be able to scroll to the top of a specific page and toggle the div to show a hidden search form.
Below is what I have at the top of the page
<p>
<center>
<a href="javascript:toggle('filterresults')">
<div class="mobile-button">☰ Filter Results</div>
</a>
</center>
</p>
<div id="filterresults" style="display:none">SEARCH FORM HERE</div>
What I would like is as a user scrolls down the page a button fixed to the bottom appears allowing them to scroll back to the top and open the toggled div which is set to hide.
Is this possible? If so, any ideas how to implement it. Thank's for any advise offered.
UPDATE Ok, this is what I've figured out so far which does what I want, this only thing I could do with is having the button fade in as the user scrolls down so far of the page
<script type="text/javascript">//<![CDATA[
var x = document.getElementById('filterresults');
function myFunction() {
if (x.style.display === 'block') {
x.style.display = 'none';
} else {
x.style.display = 'block';
}
$("html, body").animate({ scrollTop: 0 }, "slow");
}
</script>
<button onclick="myFunction()">Toggle Results</button>