Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Page & Category Menu Bars »

Trying to make pages menu sticky - javascript trouble?


 
Prev Previous Post   Next Post Next
  #1  
Old Sep 25, 2012, 10:44 AM
crashley1784
 
81 posts · May 2009
Trying to make pages menu sticky - javascript trouble?

Hey all,

I'm trying to make the pages menu on the site I'm working on stick to the top of the page when the user scrolls down, following the tutorial here: http://www.dwuser.com/education/cont...vigation-menu/

I've followed the steps, making the (what I thought were) necessary tweaks to the javascript for ata.
Here is the javascript:
Code:
$(function() {
    // Stick the #nav to the top of the window
    var nav = $('#nav');
    var navHomeY = nav.offset().top;
    var isFixed = false;
    var $w = $(window);
    $w.scroll(function() {
        var scrollTop = $w.scrollTop();
        var shouldBeFixed = scrollTop > navHomeY;
        if (shouldBeFixed && !isFixed) {
            nav.css({
                position: 'fixed',
                top: 0,
                left: nav.offset().left,
                width: nav.width()
            });
            isFixed = true;
        }
        else if (!shouldBeFixed && isFixed)
        {
            nav.css({
                position: 'static'
            });
            isFixed = false;
        }
    });
});
​
I placed the javascript in the HTML Inserts: header field. Is this where I need to put it? Or should I place it in one of the core theme files?

I changed
Code:
var nav = $('#nav');
to include first the ul# for the menu (ul#rmenu2), and when that didn't work I tried using the containing div id (menu1).

Neither is working.
I know next to nothing about javascript or jquery (it's on my todo list), so any help with this would be greatly appreciated.

Link to site: http://www.laurenacooper.com/ohprefresh
 

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Trouble controlling sticky intro post in liquid layout anartist Atahualpa 3 Wordpress theme 6 Sep 19, 2012 01:03 PM
How to make sticky posts with a large photo cwjorgensen Post-Kicker, -Byline & -Footer 1 Mar 6, 2011 03:09 PM
How do I make one custom link in the Pages Menu? kippiper Page & Category Menu Bars 22 Sep 5, 2010 08:20 PM
Make post sticky capetan Forum How-To 7 Apr 12, 2010 01:20 PM
[SOLVED] How to make Pages dropdown menu go UP :) Burn Menus 4 Nov 26, 2009 12:17 PM


All times are GMT -6. The time now is 01:44 PM.


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