jquery - how to target padding bottom with .replace mthod -


New to jQuery and I am trying to modify this script:

  $ (Function () (position "footer"); function position footer () {var padding_top = $ (". Footer") .css ("padding-top"). Substitution ("px", ""); var Page_height = $ (document.body) .height () - padding_top; var window_height = $ (window) .height (); var difference = window_height - page_height; if (difference <0) difference = 0; $ (". Footer "). CSS ({padding: difference +" px 0 0 "}) $ (window) .setset (positionFooter)});   

This works fine; I just want to add padding-top to the padding-bottom in the body container instead of the clergy, because there is currently a difference between body bg and footer.

html:

  & Lt; Div class = "sys_main_content container" & gt; & Lt; Section & gt; & Lt; / Div & gt; & Lt; Footer class = "footer" & gt;   

I want to add padding at the section section below. It did not work:

  $ (function () {positionFooter (); function status footer () {var padding_top = $ ("section"). CSS ("padding-down"). ("Px", ""); var page_hett = $ (document.body) .height () - padding_top; var window_height = $ (window) .height (); var difference = window_height - page_height; if (difference < 0) difference = 0; $ ("section"). Css ({padding: difference + "0 px 0"}) $ (window) .set reset (positionFooter)});   

Although it is close ... I can see style inserted, it is just empty

Many thanks in advance

You can use one of these

  $ ("section") .css ({padding : "0 0" + difference + "px 0"})   

or

  $ ("section"). CSS ({"padding-bottom": difference + "px"})    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -