Jump to content

[SOLVED] Jquery help


darkfreaks

Recommended Posts

okay soi am using the following Jquery dropdown nav script to create drop downs.

 

however it will not let me use more than one instance of the dropdown menu. can anyone tell me why ???

 

 

http://www.visual-blast.com/javascript/animated-drop-down-menu-with-jquery-and-css/

Link to comment
https://forums.phpfreaks.com/topic/161441-solved-jquery-help/
Share on other sites

If I have understood your question right it's not to hard, the following isn't an amazing solution, but a solution;

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Animated Drop Down Menu with jQuery</title>
<link href="example_files/style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="example_files/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("ul.menu_body li:even").addClass("alt");
    $('img.menu_head').click(function () {
	var ul = $(this).attr('rel');
	$('ul#' + ul).slideToggle('medium');
    });
$('ul.menu_body li a').mouseover(function () {
	$(this).animate({ fontSize: "14px", paddingLeft: "20px" }, 50 );
    });
$('ul.menu_body li a').mouseout(function () {
	$(this).animate({ fontSize: "12px", paddingLeft: "10px" }, 50 );
    });
});
</script>

</head>
<body>
<div class="container" style="float: left;">
<img src="example_files/navigate.png" rel="1" class="menu_head" width="184" height="32">
<ul style="display: none;" class="menu_body" id="1">
<li><a href="#">About Us</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Clients</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Support Forums</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Contact Us</a></li>
</div>
<div class="container" style="float: left;">
<img src="example_files/navigate.png" rel="2" class="menu_head" width="184" height="32">
<ul style="display: none;" class="menu_body" id="2">
<li><a href="#">About Us</a></li>
<li><a href="#">Portfolio</a></li>
<li><a href="#">Clients</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Support Forums</a></li>
<li><a href="#">Gallery</a></li>
<li><a href="#">Contact Us</a></li>
</ul>
</div>
</body></html>

Link to comment
https://forums.phpfreaks.com/topic/161441-solved-jquery-help/#findComment-851958
Share on other sites

Jquery:

 

<script type="text/javascript">
$(document).ready(function () {
$("ul.members li:even").addClass("alt");
$('img.members_head').click(function () {
$('ul.members').slideToggle('medium');
});

$('ul.members li a').mouseover(function () {
$(this).animate({ fontSize: "14px", paddingLeft: "20px" }, 50 );

});

$('ul.members li a').mouseout.(function () {
$(this).animate({ fontSize: "12px", paddingLeft: "10px" }, 50 );
});
});
</script>

HTML:

 <td width="39" valign="top"><img src="images/nav1.gif" width="92" height="35" /></td>
      <td width="137" valign="top"><img src="images/nav2.gif" class="menu_head"> <ul class="menu_body">
  <li><a href="#">Join</a></li>
  <li><a href="#">Rules</a></li>
  <li><a href="#">Staff</a></li>
  
</ul>	  </td>
      <td width="23" valign="top"><img src="images/nav3.gif" class="members_head" /><ul class="members">
  <li><a href="#">WWCF Roster</a></li>
  <li><a href="#">Champions</a></li>
  <li><a href="#">Title History</a></li>
  <li><a href="#">Archives</a></li>
  <li><a href="#">Legends</a></li>
  <li><a href="#">Rankings</a></li>
  <li><a href="#">News</a></li>
  </ul>
  </td>

 

 

 

see my mistake?

Link to comment
https://forums.phpfreaks.com/topic/161441-solved-jquery-help/#findComment-851968
Share on other sites

You are only referencing one image and one list in your jquery, try this..

 

<script type="text/javascript">
$(document).ready(function () {
$('ul.members li:even', 'ul.menu_body li:even').addClass("alt");
$('img.members_head').click(function () {
	$('ul.members').slideToggle('medium');
});

$('img.menu_head').click(function () {
	$('ul.menu_body').slideToggle('medium');
});

$('ul.members li a', 'ul.menu_body li a').mouseover(function () {
	$(this).animate({ fontSize: "14px", paddingLeft: "20px" }, 50 );
});

$('ul.members li a', 'ul.menu_body li a').mouseout.(function () {
	$(this).animate({ fontSize: "12px", paddingLeft: "10px" }, 50 );
});
});
</script>

Link to comment
https://forums.phpfreaks.com/topic/161441-solved-jquery-help/#findComment-851972
Share on other sites

works now but im trying to make everything compliant according to webdev toolbar and i get this JS error

 

Error: XML filter is applied to non-XML value (function (fn) {return fn ? this.bind(name, fn) : this.trigger(name);})

Source File: file:///C:/Users/Bryce/Desktop/wwcfnew.html

Link to comment
https://forums.phpfreaks.com/topic/161441-solved-jquery-help/#findComment-852007
Share on other sites

oh i installedfirebug lite on IE and get this........

"Expected identifier (wwcfnew.html,98)"

 

  <script type="text/javascript">
$(document).ready(function () {
   $('img.members_head').click(function () {
      $('ul.members').slideToggle('medium');
   });
   
   $('img.menu_head').click(function () {
      $('ul.menu_body').slideToggle('medium');
   });
    $('img.shows_head').click(function () {
      $('ul.shows').slideToggle('medium');
   });

   $('ul.ahows li a','ul.members li a', 'ul.menu_body li a').mouseover(function () {
      $(this).animate({ fontSize: "14px", paddingLeft: "20px" }, 50 );
   });

   $('ul.ahows li a','ul.members li a', 'ul.menu_body li a').mouseout.(function () {
      $(this).animate({ fontSize: "12px", paddingLeft: "10px" }, 50 );
   }); ////line 98
});
  </script>

Link to comment
https://forums.phpfreaks.com/topic/161441-solved-jquery-help/#findComment-852072
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.