javascript - scrollTop not working when page scrolled half way down -
i developing app iphone , have problem. using scrolltop()
navigate top of page when side panel opened. if page scrolled down as side panel can bee seen little bit wont scroll top, when can not see panel scroll top.
here html:
<div data-role="page" id="home" align="center"> <div data-role="panel" id="popuppanel" data-position="left" ontouchmove="event.preventdefault()" data-display="reveal"> <h3 id="username2" class="blocktext2"></h3> <ul data-role="listview" data-theme="b" style="margin-top:10px;"> <a data-icon="false" data-role="button" data-shadow="false" data-corners="false" data-theme="b" id="seeyourprofile" href="#yourprofile" data-transition="slide" class="contentlink">profile</a> <a data-icon='false' data-role="button" data-transition="slide" data-shadow="false" data-corners="false" data-theme="b" href="#about" class="contentlink">about</a> <a data-icon='false' data-role="button" data-transition="slide" data-shadow="false" data-corners="false" data-theme="b" href="#contacts" class="contentlink">my contacts</a> <a data-icon='false' data-role="button" data-transition="slide" data-shadow="false" data-corners="false" data-theme="b" href="#teams" class="contentlink">my teams</a> <a data-icon='false' data-role="button" data-transition="slide" data-shadow="false" data-corners="false" data-theme="b" onclick="sc.signout();return false;" class="contentlink">logout</a> </ul> </div> <div data-role="header" id="header" data-position="fixed" data-tap-toggle="false" style="z-index:99999;"> <a href="#home" data-theme="none" data-role="none" id="btpopuppanel" style="float:left;color:lightgrey;text-decoration:none;" data-direction="reverse" data-transition="slide"><i class="icon-reorder icon-2x"></i></a> <h1>news feed</h1> <a data-role="none" data-theme="none" id="btrefreshallactivities" style="float:left;color:lightgrey;text-decoration:none;" data-transition="slide"><i class="icon-refresh icon-2x"></i></a> </div> <div data-role="content"> <h3 id="noactivities">no activities found.</h3> <ul data-role="listview" data-theme="a" id="listactivities"></ul> <div id="submitbtn" style="margin-top:20px;"> <button type="submit" data-shadow="false" data-corners="false" data-role="button" data-theme="b" id="btmoreactivity">more activity</button> </div> </div>
here js:
$('#btpopuppanel').on('vclick', function() { if ($.mobile.activepage.jqmdata("panel") !== "open") { $("#popuppanel").panel("open"); $("#popuppanel").scrolltop(); } else { $("#popuppanel").panel("close"); } });
have tried $("#home").scrolltop();
, $("#popuppanel").scrollto(0,0);
didn't work. has suggestions?
found answer myself instead of using $("#popuppanel").scrolltop();
used document.getelementbyid('popuppanel').scrollintoview();
Comments
Post a Comment