Article View: pl.comp.lang.javascript
Article #49906Re: jquery odwołanie do obiektu nadrzędnego
From: Paweł Piskorz
Date: Thu, 01 Apr 2010 19:52
Date: Thu, 01 Apr 2010 19:52
34 lines
1929 bytes
1929 bytes
On 2010-04-01 19:38, Snatch333 wrote:
> W jaki sposób można odwołać się do nadrzędnego obiektu $('#menu ul
> li') w zagnieżdżonej funkcji?
> Oto fragment kodu:
> $('#menu ul li').children('a').mouseover(function(){
Selektory się kłaniają:
http://api.jquery.com/category/selectors/
$('#menu ul li > a').mouseover(function(){
var kliknietyLink = this;
> $('#menu ul li').children('ul').hide('fast', function(){
$('#menu ul li > ul').hide('fast', function(){
> $(this).children('ul').show(); // w tym przypadku this nie odwołuje
> się do $('#menu ul li') z .mouseover
http://api.jquery.com/hide/
"The callback is not sent any arguments, but this is set to the DOM
element being animated."
$(kliknietyLink).siblings('ul').show();
> });
> });
P.S. Nie testowałem.
--
message[autor="PablO"]::after {
content:"Pozdrawiam";
}
Technical Details
Message-ID:
<hp2th8$e15$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mailReferences:
<b7579532-75f4-4ed7-9dce-3a8c33f09aa6@x3g2000yqd.googlegroups.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail From: Paweł Piskorz <nie.ma.maila@psikre.nie?> Newsgroups: pl.comp.lang.javascript Subject: Re: jquery odwołanie do obiektu nadrzędnego Date: Thu, 01 Apr 2010 21:52:03 +0200 Organization: "Portal Gazeta.pl -> http://www.gazeta.pl" Lines: 34 Message-ID: <hp2th8$e15$1@inews.gazeta.pl> References: <b7579532-75f4-4ed7-9dce-3a8c33f09aa6@x3g2000yqd.googlegroups.com> NNTP-Posting-Host: 77-253-34-53.adsl.inetia.pl Mime-Version: 1.0 X-Trace: inews.gazeta.pl 1270151528 14373 77.253.34.53 (1 Apr 2010 19:52:08 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Thu, 1 Apr 2010 19:52:08 +0000 (UTC) X-User: uhorek In-Reply-To: <b7579532-75f4-4ed7-9dce-3a8c33f09aa6@x3g2000yqd.googlegroups.com> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 Hamster/2.1.0.11 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit