• Hi,Im trying to implement a jQuery menu from this page into my Arras theme.

    so far:
    I have put the css my user user.css, I have put the html list under the get header tag in home.php and uploaded the jquery file and reffered to it im my header.php

    problem: I appologise inadvance because something tells me Im asking something very obvious and simple to the rest of you but Im still learning all this, whats completely ruined my day is I have no idea where Im supposed to put the javascript part of the menus setup. Any help will be very appreciated. cheers

Viewing 7 replies - 1 through 7 (of 7 total)
  • Look at the source of tympanus.net/Tutorials/FixedNavigationTutorial2/, there you will find the java just before </body>

    Developers usually put java scripts at bottom of page to get faster loading times (the loading halts until script is loaded otherwise).

    Thread Starter kaine

    (@kaine)

    Thanks for the response but as I explained Im pretty new and what Im trying to find out is EXACTLY where in wordpress I should put javascript. Which of the files representing space before the </body> tag does this javascript belong in, again cheers for your help

    Depending on your theme – if you use the script in all of your templates (being a menu i suppose you do?) I would put it in footer.php where I would also end the <body> tag.

    Thread Starter kaine

    (@kaine)

    thanks a million for your help, finally got it sorted, I put it at the bottom of my home.php file and it works, I had tried this before but it didnt work because I didnt know how to nest it (i think thats the right term ?? have a great one

    No problems – just make sure the script is included in all the templates you need it for (single.php, archive.php and so on) or the menu will cease to work.

    If you need it on many pages the footer.php would be a better choice since footer.php is included at the end of every page (if called for).

    Glad if I was any help

    Thread Starter kaine

    (@kaine)

    Just in case anyone else stumbles into the same issue with the tutorial above and others like it, its solved by inserting

    ` <script type=”text/javascript” src=”jquery-1.3.2.js”></script>
    <script type=”text/javascript”>
    $(function() {
    var d=300;
    $(‘#navigation a’).each(function(){
    $(this).stop().animate({
    ‘marginTop’:’-80px’
    },d+=150);
    });

    $(‘#navigation > li’).hover(
    function () {
    $(‘a’,$(this)).stop().animate({
    ‘marginTop’:’-2px’
    },200);
    },
    function () {
    $(‘a’,$(this)).stop().animate({
    ‘marginTop’:’-80px’
    },200);
    }
    );
    });
    </script> `

    just before the </body> tag in footer.php In my case the jQuery file mentioned above is uploaded in my wp installations root directory. Cheers and hope that’l help someone else

    Thread Starter kaine

    (@kaine)

    BTW, looking at the CSS in the above linked tutorial, would anyone know how to format the text so that it is not centered but at the very bottom of the tab, the only aligning I seem to be able to find is for left right and centre, is it perhaps a question of changing padding or something ???

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘where to add jquery javascript’ is closed to new replies.