JQuery doesn't set margin as it should Topic is solved

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Post Reply
User avatar
N6REJ
Joomla! Explorer
Joomla! Explorer
Posts: 342
Joined: Sun Nov 27, 2005 9:25 am
Location: Ponca City, OK
Contact:

JQuery doesn't set margin as it should

Post by N6REJ » Sat Oct 19, 2019 1:01 am

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>
Bear

User avatar
john-doe
Joomla! Guru
Joomla! Guru
Posts: 902
Joined: Tue Apr 19, 2011 7:39 pm
Location: Colombia
Contact:

Re: JQuery doesn't set margin as it should

Post by john-doe » Sun Oct 20, 2019 12:52 am

Do you have a live site where we can see it?
www.aldemar-hernandez.com - Custom templates and design services.

User avatar
N6REJ
Joomla! Explorer
Joomla! Explorer
Posts: 342
Joined: Sun Nov 27, 2005 9:25 am
Location: Ponca City, OK
Contact:

Re: JQuery doesn't set margin as it should

Post by N6REJ » Sun Oct 20, 2019 4:51 am

suddenly its behaving itself... stupid thing!
Bear

User avatar
john-doe
Joomla! Guru
Joomla! Guru
Posts: 902
Joined: Tue Apr 19, 2011 7:39 pm
Location: Colombia
Contact:

Re: JQuery doesn't set margin as it should

Post by john-doe » Sun Oct 20, 2019 1:41 pm

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.
www.aldemar-hernandez.com - Custom templates and design services.

X-Bumble
Joomla! Explorer
Joomla! Explorer
Posts: 447
Joined: Sat Feb 02, 2008 12:39 pm
Location: England
Contact:

Re: JQuery doesn't set margin as it should

Post by X-Bumble » Thu Oct 24, 2019 4:26 pm

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.
Michael Edwards - UK Web developer and Designer - http://www.michaeledwards.me.uk


Post Reply

Return to “Templates for Joomla! 3.x”