English 中文(简体)
Jquery - 在一个简单下降的男子中操纵课
原标题:Jquery - manipulating classes in a simple dropdown menu

所有人,

此前,我张贴了question。 但的确会得到答案(因为措辞不准确)。 在增订/测试该守则后重新定位的幅度更大。

我想简单地缩小菜单:Jsfiddle

<<>PROBLEM

菜单 down倒,一tab,一fold一.,三fold。 然而,当菜单落到坡道时;另一个tab点被点击时,便会 shape,即其他菜单不会下降。

Ive tested the jquery code extensively using firebug & have noticed a lot of abnormalities. E.g. I thought for my purpose, the jquery code: $( ul , curTab).*** would be the same as $(curTab).children(0).***, sometimes this code runs fine, other times it doesn t.

Consistently Ive noticed the addClass & removeClass method not adding & removing the class as intended.

The if ($( .cTabActive )){...} doesn t work, syntax error?
If I do if ($( .cTabActive , aFileTabs)){...}, this doesn t work either...

在我的目击者最后,这本所谓的简单法典是完全的。 希望将受到高度赞赏。

Code: (Please review the jsfiddle.net code above)

<><>:>

  <div id="filemenu">                     <!-- right tabs menu -->
            <ul id="fm_ul">
                <li class="filetabs">File
                    <ul class= cDropDownItems >
                        <li class="m_items"><a href="#"><span class="aHeading">New</span><span class="shortcutK">Ctrl-U</span></a></li>
                        <li class="m_items"><a href="#"><span class="aHeading">Open</span><span class="shortcutK">Ctrl-Z</span></a></li>
                    </ul></li><li class="filetabs">Edit
                    <ul class= cDropDownItems >
                        <li class="m_items"><a href="#"><span class="aHeading">Undo</span><span class="shortcutK">Ctrl-M</span></a></li>

                    </ul></li><li class="filetabs cLastFileTabs">Settings
                    <ul class= cDropDownItems >
                        <li class="m_items m_itemsCK" id="frontView"><a href="#"><img src="Img/tickB&W1.png" alt="tick" /><div class="filler"></div><span class="aHeading">Front View</span><span class="shortcutK">Ctrl-A</span></a></li>
                    </ul></li>
            </ul>
        </div>                    <!-- close ->  filemenu  div -->
    </div>                    <!-- close ->  menu_bars  div -->

www.un.org/french/ga/president

$( .filetabs ).on( click , function (e) {
        function abc() {
            if ($(curTab).hasClass ( cLastFileTabs )) {
                $( ul , curTab).css ({left:  -66.6% });
                $( ul ,curTab).animate ({opacity: 1}, 125,  linear );
            }    else     {
                $( ul , curTab).css ({left: 0});
                $( ul , curTab).animate ({opacity: 1}, 125,  linear );
            }  }

    var aFileTabs = $( .filetabs );
    var curTab = $(this);
    if ($( .cTabActive ))   {
        var prevDropDown = $( .cTabActive ).parent();
        var prevDDChild = $(prevDropDown).children(0);
        $(prevDDChild).removeClass( cTabActive ).addClass( cPrevTabActive );  }
    if ($( ul ,aFileTabs).hasClass( cPrevTabActive ))  {
        $( .cPrevTabActive ,aFileTabs).animate ({opacity: 0}, 500,  linear , function ()  {
            $( ul , aFileTabs).css ({left:  9999px });
            $( ul , aFileTabs).removeClass ( cPrevTabActive );   }); }
    if ($(prevDropDown).get(0) !== $(curTab).get(0))  {
        $(curTab).children(0).addClass ( cTabActive );
        abc();
    } else  {
        return;
    }  });
最佳回答
问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签