JavaScript 或 JQuery 问题 Div 不切换

标签 javascript css

我认为我为此遗漏了一些部分。我对 JavaScript 和 JQuery 有点陌生,之前有人试图提供帮助,但他们的解决方案也不起作用。

我需要一种类似于此站点上的下拉导航效果: professional-painters.com 然后点击“快速联系”

出于某种原因,联系人没有切换。

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm2.aspx.cs" Inherits="DaVincisApp1.WebForm2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="~/Styles/StyleSheet1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="Scripts/jquery-1.4.1.min.js"></script>
<%--<script type="text/javascript" src="Scripts/motion.js"></script>--%>
<script type="text/javascript">
    $(document).ready(function(){     /* make sure the contact form is hidden when the page loads: */     $('div#contact-form').hide();      $('a#contact-button').toggle(function(){         /* slides the contact form down and shows it */         $('div#contact-form').slideDown();     }, function () {         /* hides it again */         $('div#contact-form').slideUp();     } } 
);</script>
</head>
<body>
<div id="nav">
    <div id="navigation-primary">
        <ul>
            <li><a href="#">Menu 1</a></li>
            <li><a href="#">item 2</a></li>
            <li><a href="#">Menuitem 3</a></li>
            <li><a id="contact-button" href="#">Contact</a></li>
        </ul>
        <div id="contact-form">
            <form action="#" method="post">
            <div class='hiddenFields'>
                <input type="hidden" name="ACT" value="20" />
                <input type="hidden" name="URI" value="index" />
                <input type="hidden" name="XID" value="1c46d517779f90c9f5a13bac8338968a3c2b9d16" />
                <input type="hidden" name="status" value="open" />
                <input type="hidden" name="return" value="consultation/thank_you" />
                <input type="hidden" name="redirect_on_duplicate" value="" />
                <input type="hidden" name="RET" value="http://professional-painters.com/" />
                <input type="hidden" name="form_name" value="Quick" />
                <input type="hidden" name="id" value="freeform" />
                <input type="hidden" name="params_id" value="136390" />
                <input type="hidden" name="site_id" value="1" />
            </div>
            <fieldset style="padding: 7px;">
                <table id="quickcontact-in">
                    <tr>
                        <td>
                            <input tabindex="1" class="field" type="text" name="name" value="Name" onfocus="if (this.value == 'Name') this.value = '';"
                                onblur="if (this.value == '') this.value = 'Name';" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input tabindex="2" class="field" type="text" name="email" value="Email address"
                                onfocus="if (this.value == 'Email address') this.value = '';" onblur="if (this.value == '') this.value = 'Email address';" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input tabindex="3" class="field" type="text" name="phone1" value="Phone (optional)"
                                onfocus="if (this.value == 'Phone (optional)') this.value = '';" onblur="if (this.value == '') this.value = 'Phone';" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <textarea tabindex="4" class="txtField" cols="4" rows="4" name="comments">Questions or Comments</textarea>
                        </td>
                    </tr>
                     <tr>
                        <td>
                            <div id="submit">
                                <input tabindex="6" type="submit" name="submit" value="Send Request" />
                            </div>
                            <p class="tiny" align="right">
                                <a href="javascript:;" onmousedown="toggleSlide('quickcontact');">Close</a></p>
                        </td>
                    </tr>
                </table>
            </fieldset>
            </form>
        </div>
    </div>
</div>
</body>
</html>

#navigation-primary {
/*background: url("/img/nav_back.gif") repeat-x scroll 0 0 #61533F;*/
background-color: Red;
left: 0;
position: absolute;
top: 46px;
z-index: 1;
}

#nav {
height: 34px;
width: 878px;
}

#contact-button a {
/*background: url("/img/nav_contact.gif") no-repeat scroll 0 0 transparent;*/
background-color: Green;
width: 109px;
}

#quickcontact {
background: none repeat scroll 0 0 #666449;
border-left: 2px solid #3D352B;
color: #FFFFFF;
padding: 10px;
position: absolute;
right: 0;
text-align: left;
top: 75px;
width: 245px;
z-index: 1000;
}

#quickcontact-in a {
color: #FFFFFF;
}

#quickcontact fieldset {
border: medium none;
}

#quickcontact-in .field {
background: none repeat scroll 0 0 #FEFBD5;
border: 2px solid #FFF1BD;
color: #666666;
padding: 2px;
width: 190px;
}

#quickcontact-in .txtField {
background: none repeat scroll 0 0 #FEFBD5;
border: 2px solid #FFF1BD;
color: #666666;
display: block;
float: left;
font: 1em "Lucida Sans Unicode",Verdana,Arial,Helvetica,sans-serif;
height: 90px;
margin: 5px 0 7px;
outline: medium none;
padding: 2px;
width: 190px;
}

最佳答案

快速混搭示例 here .我认为您可以使用 slideToggle()。看here更多示例。

关于JavaScript 或 JQuery 问题 Div 不切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4946866/

相关文章:

css - 边框左渐变

html - 如何选择放置在未知级别的元素

javascript - jQuery 动画循环回调

javascript - 如何在 JavaScript 中以正确的格式格式化日期

javascript - 切换不适用于复选框

html - 防止 ? (问号)不被视为分隔符之类的空白

javascript - jquery 中的 show() 方法不起作用

javascript - 重构 KnexJS 多重 Promise

javascript - 数组递归起点终点

html - 如何使 <legend> 元素居中 - 使用什么代替对齐 :center attribute?