Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/performance/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery动画函数不稳定_Jquery_Performance_Jquery Animate - Fatal编程技术网

jquery动画函数不稳定

jquery动画函数不稳定,jquery,performance,jquery-animate,Jquery,Performance,Jquery Animate,我有一个简单的动画功能,它可以工作,但当鼠标悬停/快速离开时,它不稳定/或不能正常工作。特别是在鼠标左移功能有些时候不起作用。在那里用鼠标快速移动,你会发现问题的 jQuery(document).ready(function(){ jQuery('#social_link1').hover(function () { jQuery(this).animate({ width: '+=130px', }, 200, '', function () {

我有一个简单的动画功能,它可以工作,但当鼠标悬停/快速离开时,它不稳定/或不能正常工作。特别是在鼠标左移功能有些时候不起作用。在那里用鼠标快速移动,你会发现问题的

jQuery(document).ready(function(){
  jQuery('#social_link1').hover(function () {
    jQuery(this).animate({
        width: '+=130px',
    }, 200, '', function () {
       if(jQuery(this).children('span').length < 1){
                jQuery(this).append('<span>ফেইসবুকে আমরা</span>');
        }
    });


}, function () {
    jQuery(this).children('span').remove();
    jQuery(this).animate({
        width: '-=130px',
    });

});

jQuery('#social_link2').hover(function () {
    jQuery(this).animate({
        width: '+=130px',
    }, 200, '', function () {
       if(jQuery(this).children('span').length < 1){
                         jQuery(this).append('<span>টুইটারে আমরা</span>');
                 }
    });


}, function () {
    jQuery(this).children('span').remove();
    jQuery(this).animate({
        width: '-=130px',
    });

});

jQuery('#social_link1,#social_link2').mouseleave(function(){
           jQuery(this).children('span').remove();
     });
});
详见 jquery中还有一个and函数。所以它只在进入元素和离开元素时触发

但在您的情况下,我建议您使用纯css,因为这样可以更好地解决性能问题,也更易于管理

您可以通过使用

在这种情况下,我用css转换更新了你的小提琴

-webkit-transition:width 0.5s ease-in-out;
        transition:width 0.5s ease-in-out;

问候timmi

使用stoptrue,true Yes boss@charlieftfl。非常感谢。这是你努力的结果。但css3可能会造成浏览器问题。我的jquery现在运行得很好,但只是在i.e。