javascript - Scroll to top of jQuery-Textarea -


i'm trying add "change log" jquery mobile application. in case of error, user should have capability, see went wrong. therefor i've implemented popup, textarea (see code below)

        <!-- dialog start-->         <div data-role="popup" id="popuplog" data-overlay-theme="a" data-theme="b" style="max-width:400px;" class="ui-corner-all">         <div data-role="header" data-theme="b" class="ui-corner-top">         <h1>logg-einträge:</h1>         </div>         <div data-role="none" data-theme="b" class="ui-corner-bottom ui-content">         <textarea style="height: 120px; max-height: 120px" readonly="readonly" data-mini="true" cols="40" rows="8" id="popuptextarea"></textarea>         <a href="#" data-role="button" data-inline="true" id="btn_textarea" data-rel="back" data-theme="c">ok</a>             </div>         </div>         <!-- dialog end--> 

this popup filled data, , opened when clicking specific button:

$('#showlog').click(function() {     $("#popupdialog").popup("close");     // populate textarea text     $("#popuptextarea").text(sessionstorage.getitem("logstack"));     // open popup after specific time      settimeout( function(){$('#popuplog').popup('open');           }, 1000 ); }); 

all functionality working fine point. problem is: when user scrolls down within textarea, closes popup , re-open it, position of scroller still same - example user scrolls down bottom, closes popup , reopens - popup @ bottom of textarea agein. i'd allways top of textarea, when popup opend again. realizing this, i've implemented "ok"-button in popup follows, closes popup , set scrollingtop 0:

$('#btn_textarea').click(function() { // setting position of textarea "0" -> doesn't work.....      $('#popuptextarea').scrolltop(0);      ); }); 

i'm struggeling @ point, because appearance of textarea still same. need refresh or something? grateful every help....

you use "popupbeforeposition" event manipulate scrolltop property of textarea:

$(document).ready(function(){      $("#examplewindow").on("popupbeforeposition", function(evt, ui){          $(this).find("textarea").scrolltop(0);      });  }); 

here have jsfiddle example: http://jsfiddle.net/elchininet/ebp7s/


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -