Page 1 of 1

JQuery doesn't set margin as it should

Posted: Sat Oct 19, 2019 1:01 am
by N6REJ
OK! I"m ready to pull my hair out. I have this script that gets the height of the "navbar-fixed-bottom" ( 50px )
and sets the page margin/padding to compensate.
problem is its setting it to 32px! How can the 2nd part which returns 50 in scratchpad put 32 when it writes it?

Code: Select all

<script type="text/javascript">
    "use strict";
    <!-- find out how high the header is -->
    jQuery(document).ready(function () {
        jQuery('#main').css({"padding-bottom": jQuery('nav.navbar-fixed-bottom').outerHeight( true )});
    });
</script>

Re: JQuery doesn't set margin as it should

Posted: Sun Oct 20, 2019 12:52 am
by john-doe
Do you have a live site where we can see it?

Re: JQuery doesn't set margin as it should

Posted: Sun Oct 20, 2019 4:51 am
by N6REJ
suddenly its behaving itself... stupid thing!

Re: JQuery doesn't set margin as it should

Posted: Sun Oct 20, 2019 1:41 pm
by john-doe
N6REJ wrote:
Sun Oct 20, 2019 4:51 am
suddenly its behaving itself... stupid thing!
Maybe was something of cache on browser. If comes back tell us.

Re: JQuery doesn't set margin as it should

Posted: Thu Oct 24, 2019 4:26 pm
by X-Bumble
It's best if you just use CSS to do this. Using JQuery for something so simple is overkill. The more scripts you have running on your site, the slower the site will load. Do a search on CSS solutions as this is quite easy to do.