Jquery toggle Left to right animation

2019-08-31 08:44发布

问题:

I have created a jquery toggle animation but for some reason it isn't working.

Can Anyone be of assistance?

Please see updated fiddle. class="search-container-wrap" is meant to slide out from left to right

http://jsfiddle.net/VdWFm/

        /*  SHOWS CHART SEARCH
    ===================================================================*/
$(document).ready(function(){
    $('.search-charts-go').click(function (e) {
    e.stopPropagation();
    $('.search-container-wrap').hide('slide', {direction: 'left'}, 500);
    $(this).next('.search-container-wrap').stop().show('slide', {direction: 'left'}, 500);
   });
});

Thanks a bunch !!!!

回答1:

Your problem lies in $(this).next('.search-container-wrap') since the anchor being clicked doesn't have such a sibling. Try $('.search-container-wrap') instead as shown in this fiddle.

I took the liberty of making it slide in and out as well.