What is the whole subject, there is a code:

<ul id="menu"> <li>111</li> <li class="cart_informer"> </li> 

To get to 111, you need to do this:

 $('#menu > li') 

What do you need to do to get to cart_informer?

addition: <! - Menu -> <ul id = "menu"> <script type = "text / javascript"> $ (function () {var d = 300; $ ('# menu a'). each ( function () {$ (this) .stop (). animate ({'marginTop': '-80px'}, d + = 150);});

  $('#menu > li').hover( function () { $('a', $(this)).stop().animate({ 'marginTop': '-2px' }, 200); }, function () { $('a', $(this)).stop().animate({ 'marginTop': '-80px' }, 200); }); }); </script> {foreach $pages as $p} {* Выводим только страницы из первого меню *} {if $p->menu_id == 1} <li {if $page && $page->id == $p->id}class="selected"{/if}> <a data-page="{$p->id}" href="{$p->url}">{$p->name|escape}</a> </li> {/if} {/foreach} <li class="cart_informer"> {include file='cart_informer.tpl'} </li> </ul> <!-- Меню (The End) --> 

And this is the basket item code

 $('form.variants').live('submit', function (e) { e.preventDefault(); button = $(this).find('input[type="submit"]'); if ($(this).find('input[name=variant]:checked').size() > 0) variant = $(this).find('input[name=variant]:checked').val(); if ($(this).find('select[name=variant]').size() > 0) variant = $(this).find('select').val(); $.ajax({ url: "ajax/cart.php", data: { variant: variant }, dataType: 'json', success: function (data) { $('#menu > li.cart_informer').html(data); if (button.attr('data-result-text')) button.val(button.attr('data-result-text')); } }); var o1 = $(this).offset(); var o2 = $('#menu > li.cart_informer').offset(); var dx = o1.left - o2.left; var dy = o1.top - o2.top; var distance = Math.sqrt(dx * dx + dy * dy); $(this).closest('.product').find('.image img').effect("transfer", { to: $('#menu > li.cart_informer'), className: "transfer_class" }, distance); $('.transfer_class').html($(this).closest('.product').find('.image').html()); $('.transfer_class').find('img').css('height', '100%'); return false; }); 


    4 answers 4

    $ ('# menu> li.cart_informer')

    but in general there is a very useful resource for a beginner in Russian: http://jquery.page2page.ru

      You can also like this:

       var $menu_li = $('#menu > li'); $menu_li.eq(0) - <li>111</li> $menu_li.eq(1) - <li class="cart_informer"></li> 

        Through $('#menu > li) you get all the child li , not just the first.
        Something like $('#menu .cart_informer') will return all li.cart_informer .
        You can also be helped by .last() :last-child .last() :nth-child() , etc., etc.

        upd:
        Now I understand what you are trying to do. Guidance you need to hang on all menu items except the basket:

         $('#menu > li').not('.cart_informer').hover(.. // или как там у вас оно // здесь ищем все дочерние li, у которых нет класса cart_informer 

        And for a basket something of your own:

         $('#menu > .cart_informer')... // действия // тут наоборот - все дочерние элементы с классом cart_informer 

        Do not overlook the documentation .

        • The difficulty is that I absolutely do not know java, but I don’t have time to learn. Therefore, I ask for help. The main task is to make a horizontal menu of this type i51.fastpic.ru/big/2013/0228/df/… - Alexey Ermakov
        • When you hover the cursor, the menu should fall to the bottom ... But there still is a basket ... it still has one feature. when you press the button "in the basket" - the image of the product flies to the menu. more precisely, to the item "basket" ... when the image reaches there. that she either did not turn around ... or turned off after that? .... PS added the code in the first post - Alexey Ermakov
        • Updated his answer - xEdelweiss
        • no ... the basket should have the same properties as all categories in the menu + its own details .... everything works, but after the product reaches the basket it falls out and does not roll back ... - HoPkInS
        • @HoPkInS, and although you are not the author of the question, my answer will be the same - all the tools, even with examples, are presented in my answer. What properties are we talking about? Should the basket fall down as well? So remove the exception by class. - xEdelweiss

        The fastest option:

         var cartInformer = $('#menu').children('.cart_informer'); 
        • What's this?. Can be more? - Alexey Ermakov
        • You asked: "And what do you need to do to get to cart_informer?" This is the answer. The fastest jquery, provided you have one .cart_infromer, and not a few. - Gena Tsarinny