English 中文(简体)
使用 jQuery 隐藏菜单
原标题:Hide Menu using jQuery

我是新来的JQuery 需要点帮助

我创建了一个导航菜单, 用户在“ 3 秒后” 登陆页面后, 我想从上面完全消失。 从此, 箭头将隐藏原始导航菜单 。

当用户点击“ 箭头” 时, 菜单将回到视图中, 并停留在那里20秒。

我这里有一些密码,但似乎什么也没有做,有人能帮上忙吗?

http://jsfiddle.net/headex/AsjMz/1/

任何传递的信息都会感激不尽

干杯 干杯

最佳回答

您的现场示例中的错误是,您将函数的名称以 , 换句话说, 将函数的名称传给设置的TimeOut 函数

您拥有这个

  setTimeout("MenuOut", 3000);

为此更改

  setTimeout(MenuOut, 3000);

请在此以您这个变化为例 : Demo

问题回答

You have to use the correct selectors for your <div/> Elements and supply the MenuOut() Function as an object, not a string.

$(function() {
    setTimeout(MenuOut /*don t supply this parameter as a string*/, 3000); /* 3000 represent 3000 milliseconds, so 3 seconds */
});

function MenuOut() { /* The sample code I put on top */
    $( #nav /*it s an id (#), here you have to use a string*/).slideUp();
}

而不是使用动画, 而是使用 jQuery s 滑动和滑动来查看 。

您会想要像这样的动画 : setTimeout ("$" (#nav). slideUp (), 3000;

You had a few errors with your JS. setTimeout requires a function callback, not a string. You also used $(nav) instead of $("#nav")

http://jsfiddle.net/AsjMz/9/





相关问题
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.

热门标签