How do i make toggle from left whitout jquery-ui

2019-07-21 02:13发布

问题:

How do i make toggle from left without using jquery-ui

Javascript

$(document).ready(function(){
    $("button").click(function(){
        $("#content").slideToggle();
    });
});

HTML

<div id="content">This is a paragraph.</div>

<button>my toggle</button>

CSS

#content {
    background:khaki;
    padding:10px;
}

jsfiddle

回答1:

Here is what I came up with... fiddle. I have reinserted the paragraph within '<div id="toggle_text"></div>' and used jQuery's 'animate()' method to alter its left position so that it appears to be sliding from left direction. Hope it works for you.