Show and Hide in js [closed]

0

Hello, they are asking me for something

I have this code:

$("#divNeeds").hide(2000);
$("#divNeeds").hide("slow");
$("#divHome").show();

But this appears from the bottom up, but they are asking me to appear from right to left and I can not find what attribute to change. Do you know if it can be done for js?

Who can see how the div is going up?

Thanks for the collaboration

    
asked by Andrés Vélez 11.04.2018 в 01:03
source

1 answer

1

According to the OS user Italy in English:

here your profile: profile

here's your answer: answer

This is an example that you can use and adapt to your needs, if you access the link of the original author of the response you will notice a link still valid to jsfiddle with the functional example:

this example is HTML

<a href="#" id="button" class="button_style">Hide content</a>
<div id="hidden_content">Content</div>

with the help of jquery 1.8 or higher

$(document).ready(function() {
    $("#button").toggle(function() {
        $(this).text('Show Content');
    }, function() {
        $(this).text('Hide Content');
    }).click(function(){
        $("#hidden_content").animate({width: 'toggle'}, "slow");
    });
});

To help the effect you are looking for, it is also done from CSS so

a {
    display: block;
}
#hidden_content {
    display: inline-block;
}
    
answered by 11.04.2018 / 01:34
source