@amitburst It's better to put the margin calculate into `$(document).ready`. Wherever the scripts to be placed, it will always works.