How to scroll to the selected form field when key board shown in android app with javascript or jQuery? -


i used code window scroll top in android app. scrolling total body. not till selected form field. want scroll till selected form field.

here code

var is_keyboard = false;         var is_landscape = false;         var initial_screen_size = window.innerheight;          window.addeventlistener("resize", function() {             var currentheight = window.innerheight;             is_keyboard = (window.innerheight < initial_screen_size);             is_landscape = (screen.height < screen.width);             var keyboardsize = (initial_screen_size - currentheight);              if (keyboardsize > 0) {                 alert("keyboard shown! size is: " + keyboardsize);             } else {                 alert("keyboard closed!");             }              alert('screen resized. currentheight: ' + currentheight + " - originalheight: " + initial_screen_size);          }, false);   

to scroll selected field need set class or id on element on capturing event need check flag on element , find offset , scroll document it. hope helps

if (scroll_flag == ' scroll1'){        var foooffset = $('#gift').offset(),         destination = foooffset.top;         console.log(destination);       $(document).scrolltop(destination);     } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -