CSS - < p>滑动时留下足迹 [英] CSS - <p> leaving a trail when sliding

查看:90
本文介绍了CSS - < p>滑动时留下足迹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个< p> 标签,当它开始从左向右滑动时,它在屏幕上留下一种踪迹。

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.

我使用jQuery来动画它:

I'm animating it using jQuery:

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

这里是截图:

推荐答案

您可以尝试使用简单的CSS转换,而不是jquery。因为jquery通过改变css属性来做动画,并且是不一样的。

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

因此,使用jquery添加一个类,其结束状态为:

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;
}

这篇关于CSS - &lt; p&gt;滑动时留下足迹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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