在我的网站的底部,我将有一个即时聊天的上拉菜单部门。我正在使用Javascript来拉起菜单。Javascript上拉菜单
我有一个ID为'chatTab'的选项卡,实际的聊天消息进入ID'聊天'。聊天标签位于页面底部,直到您点击它,然后随聊天一起上传。问题是,它不会拉起来。我已经使用onClick方法与我的选项卡部门,并确认它的工作原理,所以问题是在JS的某处。
var current;
var pullChat = 0;
var pullMenu = function() {
if(pullChat === 0) {
current = document.getElementById('chatTab');
current.style.bottom = '300';
alert('pie');
current = document.getElementById('chat');
current.style.bottom = '0'; //starts at -300
}
}
警告消息是我测试一行代码是否在运行的情况,在这种情况下它会运行。
我的HTML很长,但是这是两个重要的事情:
<div id='chatTab' onClick='pullMenu()'>Instant Chat</div>
<div id='chat'></div>
下面是重要物品CSS:
#chatTab {
z-index:1000;
position:fixed;
bottom:0;
background-color:#FF9933;
color:white;
width:100%;
margin:0;
padding:0;
text-align:center;
font-size:1.8em;
}
#chatTab:hover {
cursor:pointer;
}
#chat {
z-index:1001;
position:fixed;
padding:0;
margin:0;
bottom:-300px;
height:300px;
}
你还可以包含必要的HTML标记吗? – chridam 2014-09-29 13:50:05
好吧,我添加了两件重要的事情。 HTML的其余部分与此无关。 – turkey3 2014-09-29 13:53:48
@ turkey3旁注:鉴于你提出的许多问题,你应该接受已经解决了部分或全部问题的答案,包括今天的最新问题http://stackoverflow.com/q/26290663/。如果您不知道如何,请参阅以下链接** http://meta.stackexchange.com/a/5235/** - Stack系统的构建是有原因的。 – 2014-10-10 02:13:12