我有下面的這個html + css代表一個頁面左邊的按鈕和一個直接在它旁邊的簡單聯繫人窗體。jQuery滑出窗體
我想爲表單設置動畫,以便當單擊按鈕時,表單從左側滑入視圖,並在再次單擊按鈕時退出。
我試圖按照jQuery教程,但似乎沒有工作。
HTML:
<ul class="rotate" id="callback">
<li>
<a href="#call">Request A Callback</a>
</li>
</ul>
<div id="callbackform">
<?php echo do_shortcode('[contact-form-7 id="1472" title="Callback"]'); ?>
</div>
CSS:
/* Callback Button and Form */
#callback {
position: fixed;
top: 300px;
left: -80px;
padding: 0;
list-style: none;
z-index: 9999;
}
#callbackform {
position: fixed;
background-color: #ffffff;
text-align: center;
top: 223px;
/* left: 45px; */
left: -245px;
padding: 1.5px;
list-style: none;
z-index: 9998;
}
#callback li a {
display: block;
background-color: #B22222;
padding: 10px 10px 5px 10px;
font-size: 20px;
color: #5F9EA0;
font-weight: 600;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}
/* Rotate Text on Button */
.rotate {
/* Safari */
-webkit-transform: rotate(-90deg);
/* Firefox */
-moz-transform: rotate(-90deg);
/* IE */
-ms-transform: rotate(-90deg);
/* Opera */
-o-transform: rotate(-90deg);
/* Internet Explorer */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
}
代碼嘗試:
jQuery('#callback').click(function() {
jQuery('#callbackform').toggle('slide', {
direction: 'left'
}, 1000);
else{
jQuery('#callbackform').toggle('slide', {
direction: 'left'
}, 1000);
}
});
請告訴我們您的jQuery代碼,你已經試過 – Sebastian
哪裏是你的JavaScript? –
@塞巴斯蒂安補充說 – Jason