I have a created a search system and have the screen scrolling down when the input box is clicked on only small size screens to give more focus on the input box. The scroll continues to work even if I resize the screen to out of the parameters. And visa versa (won't work if the screen started big). How do I make this work when the screen is resized.
Here is the code i have so far:
if (window.innerWidth < 700) { $(".sl-mobile").click(function () { $('html, body').animate({ scrollTop: $(".search-subheading").offset().top }, 2000); }) }else{ }