jquery - Add top padding Dynamically based on view port height -


i trying set padding dynamically based on view port height "child" div top-padding 5% of view port height.

<div id="about-us">some content  <div class="child">other content</div> </div> 

fiddle

try this:

$(document).ready(function() {     $('#about-us .child').css('padding-top', $(window).height() * 0.05);     }); 

$(window).height() height of viewport , multiplying 0.05 5%


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -