jquery - set scroll position when Show Div in a popup -


i'm trying set scroll position top of div popup. works first time after position changes, not reset top. ideas?

js:

function showpopupaddlocations() {     clearpopupdata();     $("#divideditlocation").scrolltop();     $('#divideditlocation').show();     return false; } 

css:

 .popouter {background:rgba(0,0,0,0.7); width:100%; height:100%; position:fixed; z-index:99; display:none; left:0; top:0;} .popup_main{ padding:20px; box-sizing:border-box; max-width:700px; width:100%;  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); -moz-transform: translate(-50%, -50%);  -webkit-transform: translate(-50%, -50%);  -ms-transform: translate(-50%, -50%);  -o-transform: translate(-50%, -50%); background:#fafbff;} .popup_main .popup_content{ position:relative; padding:20px 5px 0 0; max-height:500px; overflow-y:auto;} .popup_main .popup_content p em{ font-size:20px;  color:#cc4b46; font-weight:700; font-style:normal} .popup_header{ padding-bottom:15px; border-bottom:1px solid #e5e6ea;  } .popup_header h2{ font-size:28px; line-height:30px;} .popup_close{background:#fafbff url(../images/popclose_btn.png) no-repeat center center; width:20px; height:20px; top:10px; right:10px; position:absolute;} 

edit

this div opened

<div class="popouter" id="divideditlocation"> <div class="popup_main"> <a href="javascript:void(0)" class="popup_close" onclick='funchideaddresspopup();'></a> <div class="popup_header"> <h2>create location</h2> </div>  <div class="popup_content" id="dvaddeditlocationdetail"> </div> </div> </div> 

if switch

$('#divideditlocation').show(); $("#divideditlocation").scrolltop(); 

it work - div doesn´t have height donesn´t have scrollbar.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -