CSS - <p> leaving a trail when sliding

大憨熊 提交于 2019-12-13 17:28:29

问题


I've a <p> tag and when it starts sliding from left to right it leaves a kind of trail through the screen. I've never seen anything like this before.

I'm animating it using jQuery:

$(document).ready(function(){
$(".choosenHero").animate({
 "right": "300px"
}, 3000);
});

and here is the screenshot:


回答1:


You might try using simple CSS transitions rather than jquery. As jquery does animation by changing css properties and is not the same thing.

So use jquery to add a class which has the end state of say:

.moved{
    left: 300px;
}

and on the initial state of the paragraph use something like:

.moving-object{
    position:relative;
    transition: left 2s;
    left: 0px;
}


来源:https://stackoverflow.com/questions/20404364/css-p-leaving-a-trail-when-sliding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!