Return to Snippet

Revision: 69784
at September 7, 2015 21:49 by envane21


Initial Code
var clicked = false;

$(document).on('click', '#msisdn-input' , function(e){
  e.preventDefault();
  if(clicked===false){
    window.scrollTo(0,1);
    clicked = true;
  }
  setTimeout(function(){
    $('#scroll').css('float','left');
    scrollSize =  $('.submit-button').offset().top + $('.submit-button').outerHeight()+5;
    console.log(scrollSize);
    screenSize =  $(window).height();
    result = (scrollSize-screenSize);
    if(result>0){
      $('html, body').animate({scrollTop:result},'200');
    }
  },700); 
});

Initial URL

                                

Initial Description
Used to automatically scroll up the page so that it is focused on user entry (mobile devices)

Initial Title
Automatic Scroll Up

Initial Tags
mobile

Initial Language
jQuery