Text link smooth left and right movement effect

Source: Internet
Author: User

When you move the mouse to a text connection, it appears to move smoothly to the right.
For example:
HTML code:
http://xiong.chexian666.com/
<div class= "test" ><a href= "" >test link move</a></div>
CSS code:
. Test A{position:relative;background-color: #446CB3; color: #ffffff; padding:10px; text-decoration:none;
-webkit-transition:margin 0.2s ease-out;
-moz-transition:margin 0.2s ease-out;
-khtml-transition:margin 0.2s ease-out; }
a:hover{margin-left:10px;}
The specific effect can be referred to the example I wrote: Http://codepen.io/kujian/pen/Iwnsi
Of course we know CSS3 animation is incompatible ie10 the following browsers, then we can use the JQ code to implement, the specific code is:
http://xiong.zt-4s.com/
$ (function () {
$ ("a"). Hover (function () {
$ (this). Stop (). Animate ({"Margin-left": "10px", "Text-shadow": "2px 2px 10px #333333"}, "fast");
},function () {
$ (this). Stop (). Animate ({"Margin-left": "0px"}, "fast");
});
});
You may be wondering why CSS is made up of a position:relative? In fact, this is my other way of writing, the JQ code is as follows
http://xiong.yingyanshop.com/
$ (function () {
$ ("a"). Hover (function () {
$ (this). the stop (). Animate ({"Left": "10px"},300);
},function () {
$ (this). the stop (). Animate ({"Left": "0px"},300);
});
});
Isn't it a very simple effect? Worth a try.

Text link smooth left and right movement effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.