jQuery的切换滑动不 [英] Jquery toggle not sliding

查看:123
本文介绍了jQuery的切换滑动不的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁能够帮助我修正,即时通讯试图去打开从左至右我的jQuery动画?

can anybody assist me with fixing my jquery animation that im trying to get to open from left to right?

它打开,但我想它,而不是滑动。

It opens but i want it to slide instead.

请参阅演示
http://jsfiddle.net/EY9t7/

$(function(){
    $('.search-charts-go').click(function (e) {
    e.stopPropagation();
    if($('.search-container-wrap').hasClass('visible')) {
        $('.search-container-wrap').stop().hide('slide', {direction: 'left'}, 500).removeClass('visible');
    } else {
        $('.search-container-wrap').stop().show('slide', {direction: 'left'}, 500).addClass('visible');
    }
   });
});

在此先感谢

推荐答案

您可以使用 .animate()宽滑动,像这样的例子:

You could use .animate() to slide in width like so for example:

$(function(){
    $('.search-charts-go').click(function (e) {
    e.stopPropagation();
    if($('.search-container-wrap').hasClass('visible')) {
        $('.search-container-wrap').stop().animate({
            'width' : '0'
        }, 1000, function(){
            $(this).removeClass('visible')
        });
    } else {
        $('.search-container-wrap').addClass('visible').stop().animate({
            'width' : '400'
        }, 1000);
    }
   });
});

这里是一个小提琴: http://jsfiddle.net/uyWNH/

如果你想使用显示 / 隐藏对于这一点,你就必须添加jQuery UI的...这可能是一点点的过载,如果你使用它只是为了他......

If you want to use show / hide for this, you will have to add jQuery UI... which might be a little bit overload, if you use it only for his...

这篇关于jQuery的切换滑动不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆