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>
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
Post a Comment