简体   繁体   English

从左向右滑动jQuery

[英]slide jquery from left to right

I have a div that I would like to slide from the left on button click. 我有一个div,我想在按钮单击时从左侧滑动。 Ultimately I would like to have the div have a negative so its off the screen until toggled. 最终,我希望div的值为负数,因此将其显示在屏幕之外,直到切换为止。 If the button is clicked again it should close. 如果再次单击该按钮,它将关闭。 I have tried animate and cannot seem to get it to work correctly. 我尝试设置动画,但似乎无法使其正常工作。 Here is my code. 这是我的代码。

this is the css 这是CSS

 .feature_content {
        width: 25%;
        height: 100%;
        position: fixed;
        top: 0px;
        bottom: 0px;
        right: 0px;
        overflow: hidden;
        display: none;

This is the javascript 这是javascript

     $("button").click(function(){
    $(".feature_content").toggle({left: -423});

this is the html 这是HTML

<div class="feature_content">
   this is the div to toggle
</div>


<button>This is the button</button>

$(document).ready(function(){$(“ button”)。click(function(){$(“。feature_content”)。toggle({left:-423});});});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM