I am creating a custom div scroller and want to set the top position of the contents of the div. My jquery code is as follows:
containerOuterHeight=$("#messagePopUpContainer").outerHeight(); contentOuterHeight=$("#content").outerHeight(); contentTopPosition=$("#content").offset().top; alert("contentTopPosition"+contentTopPosition); alert(contentTopPosition-(containerOuterHeight/20)); $("#content").offset().top=contentTopPosition-(containerOuterHeight/20); //$("#content").css("top",( contentTopPosition-(containerOuterHeight/20) ) + "px"); alert("contentTopPosition"+$("#content").offset().top); //alert("Fontsize"+$('#content').css('font-size') );
and html:
<div id='messagePopUpContainer' style='background-color:#ffffff; overflow: hidden;'> <a href='javascript:void(0);' id='popupanchor' onkeydown='PopupKeyHandler("' + elmId + '");'></a>
<div id='content' style='width:350px'>' + methods.settings[elmId].text + '</div > <div id='popupReturn'>Return</div></div></div>'
jquery
Rajanikant Shukla May 15 '12 at 9:23 a.m. 2012-05-15 09:23
source share