Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Spry menu bar javascript drop down not working. WordPress


I have a working spry navigation within the html part of the site. I want to match this navigation within the wordpress pages. The drop down menu function does not work as I have set it up in wordpress. I need help to get this working.

The url to an html part of the site is here:

Here is a url to a wordpress page within the site that has the same nav bar with <strong>drop down functionality NOT WORKING</strong>:

I have placed my html spry nav bar within the header.php and the links to the script and css in the head of the header.php as follows:

I added these links into the head of the header.php

<script src="../../../../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../../../../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />

Find it here:

* The Header for our theme.
* Displays all of the <head> section and everything up till <div id="main">
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
* Print the <title> tag based on what is being viewed.
global $page, $paged;

wp_title( '|', true, 'right' );

// Add the blog name.
bloginfo( 'name' );

// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " | $site_description";

// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo ' | ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );


<link rel="profile" href="" />

<script src="../../../../SpryAssets/SpryMenuBar.js" type="text/javascript"></script>
<link href="../../../../SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css" />

<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
/* We add some JavaScript to pages with the comment form
* to support sites with threaded comments (when in use).
if ( is_singular() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );

/* Always have wp_head() just before the closing </head>
* tag of your theme, or you will break many plugins, which
* generally use this hook to add elements to <head> such
* as styles, scripts, and meta tags.


The rest of my header starting at the body tag, is here and you can see I have replaced wordpress header and divs with my own which includes the drop down menu bar:

<body <?php body_class(); ?>>
<div id="wrapper" class="hfeed">
<div id="header">
<img src="../../../../images/the-last-crop-film.png" width="901" height="138" alt="the last crop film" longdesc="" />
<div id="topNav">

<ul id="MenuBar1" class="MenuBarHorizontal">
<li><a href="">Home</a></li>
<li><a href="../../../about-director-statement-bio-jeff-annie-main.html">About</a></li>
<li><a class="MenuBarItemSubmenu" href="#">Farm Issues</a>
<li><a href="../../../family-farm-issues-preservation-agricultural-easement.html">Farm Preservation</a>
<li><a href="../../../farm-succession-issues-family-farmland- views.html">Farm Succession</a>
<li><a href="../../../regional-foodsheds-watershed-sustainable-water-table-agriculture-research-maps.html">Regional Foodsheds </a>
<li><a class="MenuBarItemSubmenu" href="#">Video/Media</a>
<li><a href="../../../video-film-version-edits-farm-agriculture.html">Video</a>
<li><a href="../../../media.html">Media</a>


<li><a class="MenuBarItemSubmenu" href="#">Events</a>
<li><a href="../california-events">California Events</a>
<li><a href="../national-events">National Events</a>
<li><a href="../other-event-calendars">Other Event Calendars</a>
<li><a href="../screenings">Screenings</a>

<li><a class="MenuBarItemSubmenu" href="#">Blogs</a>
<li><a class="MenuBarItemSubmenu" href="" target="_blank">Good Humus</a>


<li><a href="../../../donate-the-last-crop-film-farm-conservation-succession.html">Donate</a></li>
<li><a href="../../../contact-questions-comments-opinions.html">Contact</a></li>

<li class="joinList"><a href="" target="_blank">Join our mailing list</a></li>

<li class="like"> <iframe src="" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:25px;" allowTransparency="true"></iframe></li>
<li class="socialLinks"><a href="" target="blank" ><img src="../../../../images/facebook-icon.png" border="0"></a></li>
<li class="socialLinks"><a href="" target="blank"><img src="../../../../images/you-tube.png" border="0"></a></li>
<li class="socialLinks"><a href="" target="blank"><img src="../../../../images/vimeo.png" border="0"></a></li>
<!-- end #header --></div>

<div id="main">

Thanks for taking a look.


Answers (2)


Kristin Falkner answers:

This is at the bottom of your HTML version and not at the bottom (in the footer.php) of your WordPress version:

<script type="text/javascript">
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"../SpryAssets/SpryMenuBarDownHover.gif", imgRight:"../SpryAssets/SpryMenuBarRightHover.gif"});

It should probably be placed -- with the relative image links adjusted -- before the closing </body> tag of the footer.php file in your theme.

Nancy Rodger comments:

BINGO!!!!! Thank you!



Linda answers:

HI, I think your WordPress needs the DOCTYPE identified. You have this on your WordPress site:
<!DOCTYPE html>

try this...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">


Nancy Rodger comments:

This code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

does not appear in the original header.php