thanks, the code run perfect in firefox, but in IE 7  don't works
well...  the divs is show and hide immediately...   do you know why?


<script type="text/javascript">
$(document).ready(function() {

        $('div.menu-h2').hide();
        //$('div.menu-h3').hide();

   $('.menu-h1 ul li a').click(function() {

      var t = $(this).attr('rel');
      $('div.menu-h2').hide();
      $('div#'+t).show('slow');

  });

});


On 2 jun, 13:04, Hamish Campbell <[EMAIL PROTECTED]> wrote:
> Two elements should never have the sameID- make sure the links and
> the paragraphs do NOT have the sameID. Some people use the 'rel' tag
> for this sort of thing. Use the class attribute to denote objects that
> should be grouped (ie, the paragraphs you want to hide) Eg:
>
> <ulid="myList">
>    <li><a rel="001" href="#">001</a></li>
>    <li><a rel="002" href="#">002</a></li>
>    <li><a rel="003" href="#">003</a></li>
> </ul>
>
> <pid="001" class="myItems"></p>
> <pid="002" class="myItems"></p>
> <pid="003" class="myItems"></p>
>
> In youjQuery, you can then do this:
>
> $(document).ready(function() {
>
>    $('#myList li a').click(function() {
>
>       var t = $(this).attr('rel');
>       $('p.myItems').hide();
>       $('#'+t).show('slow');
>
>   });
>
> });
>
> Hope this helps - and don't forget to read the documentation if yougetstuck:
>
> http://docs.jquery.com
>
> On Jun 2, 7:20 pm, jgarcia <[EMAIL PROTECTED]> wrote:
>
> > i've a dinamic menu
>
> > <ul>
> > <li><aid="001" href="#">001</a></li>
> > <li><aid="002" href="#">001</a></li>
> > <li><aid="003" href="#">001</a></li>
> > </ul>
>
> > this menu <ul> is dynamic, ie, is automatically generated from a
> > database, therefore I will not know many elements i'll have in the
> > future or what identifiers they have.
>
> > Moreover, i have some <p>, one for each <a> in the <ul>
>
> > <pid="001"></p>
> > <pid="002"></p>
> > <pid="003"></p>
>
> > If somebody do click in  <aid=001>  all <p> must be hide, but the <p
> >id=001> must be show
>
> > i've writed this code injqueryfor the case "001"  and is run
> > perfect, but a need do it general for all <a> but without
> > those elements will have a priori
>
> > <script type="text/javascript">
> > $(document).ready(function (){
>
> >         $("#content p").toggle();
>
> >         $("#menu ul li a#001").click
> >                 (
> >                 function showhide()
> >                         { $("#content p#001").toggle("slow"); }
> >                 )
> >         }
> >         )
> > </script>
>
> > understand me?
>
> > thanks in advance

Reply via email to