I am designing a scroll page that has certain effects, such as buttons appearing and dissapearing. The idea is too fade in a button as the user scrolls that section into view, and as the user leaves that area it fades out again.
i have the following jQuery script using the visible class i downloaded:
 // Fade out enquire button on page load.
   $( ".enquireNow" ).fadeOut();
 // Check to see if element is visible when user scrolls
   $(window).scroll(function() {
       if ($('.miniCity').visible()) {
          $( ".enquireNow" ).fadeIn();
        }
   });
First of all is this best practice, are there better ways to achieve this? Second, how do i make the button dissapear again when the element scrolls out of view?
 
     
    