Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   How to fix non sticking sticky footer with Jquery. (http://forum.bytesforall.com/showthread.php?t=17497)

lakewooditsupport May 7, 2012 12:43 PM

How to fix non sticking sticky footer with Jquery.
 
I've had this problem with a few versions of Atahualpa now where the footer stops sticking when selected to stick to the bottom of the screen, I'm not sure what the problem was or what if any plugin is conflicting but it seems to be a common problem. I decided to make a fix and it works perfectly on my site across all up to date browsers.

You can use the jquery script below, in the header or include it in your javascript file if you have one.

Code:

$(function(){
        positionFooter();
        function positionFooter(){
                var padding_top = $("#footer").css("padding-top").replace("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 0"
                })
        }
 
        $(window)
                .resize(positionFooter)
});

Its essentially the same as the atahualpa script but this works where the default did.

juggledad May 8, 2012 03:50 AM

doesn't work for me in Safari or firefox on the Mac.

I put it in the ato->Add HTML/CSS Inserts->HTML Inserts: Header and it just displayed the code on the screen. I then surrounded it with '<script type="text/javascript">' and '</script>' and left ato->Style & edit FOOTER->Sticky footer on short pages? set to 'NO' and the footer was not sticky. With it set to 'YES' I get both this code and the atahualpa code and it works fine...but which is working?

lakewooditsupport May 8, 2012 07:02 AM

I have no to sticky footer enabled in ATO, but the footer wasn't sticking, it did at first but must have stopped after a changes and plugins were installed.

I have removed the atahualpa javascript for the sticky footer from the js.php file and used the script above in my own javascript file. I then disabled sticky footer in options, its working in all browsers for me on PC & Mac.

It may be conflicting with other JS for you or even the original sticky footer JS. May not work for all but it fixed it for me after months on changing settings and using different methods.


All times are GMT -6. The time now is 11:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.