您好,登錄后才能下訂單哦!
這篇文章主要介紹“前端開發常用CSS動畫代碼有哪些”,在日常操作中,相信很多人在前端開發常用CSS動畫代碼有哪些問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”前端開發常用CSS動畫代碼有哪些”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!
/*導入頭部和尾部*/
$(document).ready(function(){
$(".footer").load("page/footer.html");
});
但是注意,此時的footer.html不需要是完整的HTML(當時本人自己可是遇到了這個大坑,都是淚/(ㄒoㄒ)/~~),這包含標簽內容即可。
在這里小編建了一個前端學習交流扣扣群:132667127,我自己整理的最新的前端資料和高級開發教程,如果有想需要的,可以加群一起學習交流
<!--footer.html頁面-->
<footer>
<ul class="g-flex">
<li class="g-flex-auto"><a href="#" class="i-b">首頁</a></li>
<li class="g-flex-auto"><a href="#" class="i-b">分類</a></li>
<li class="g-flex-auto"><a href="#" class="i-b">訂單</a></li>
<li class="g-flex-auto"><a href="#" class="i-b">我的</a></li>
</ul>
</footer>
前端開發常用css動畫代碼
/*向左移動并彈性顯示*/
@-webkit-keyframes fadeToLeftTan{
0%{ -webkit-transform:translateX(100%); opacity:0;}
70%{ -webkit-transform:translateX(-5%); opacity:1;}
80%{ -webkit-transform:translateX(2%); opacity:1;}
90%{ -webkit-transform:translateX(-2%); opacity:1;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeToLeftTan{
0%{ transform:translateX(100%); opacity:0;}
70%{ transform:translateX(-5%); opacity:1;}
80%{ transform:translateX(2%); opacity:1;}
90%{ transform:translateX(-2%); opacity:1;}
100%{ transform:translateX(0); opacity:1;}
}
/*向右移動并彈性顯示*/
@-webkit-keyframes fadeToRightTan{
0%{ -webkit-transform:translateX(-100%); opacity:0;}
70%{ -webkit-transform:translateX(5%); opacity:1;}
80%{ -webkit-transform:translateX(-2%); opacity:1;}
90%{ -webkit-transform:translateX(2%); opacity:1;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeToRightTan{
0%{ transform:translateX(-100%); opacity:0;}
70%{ transform:translateX(5%); opacity:1;}
80%{ transform:translateX(-2%); opacity:1;}
90%{ transform:translateX(2%); opacity:1;}
100%{ transform:translateX(0); opacity:1;}
}
/*向上移動并彈性顯示*/
@-webkit-keyframes fadeToTopTan{
0%{ -webkit-transform:translateY(100%); opacity:0;}
70%{ -webkit-transform:translateY(-5%); opacity:1;}
80%{ -webkit-transform:translateY(2%); opacity:1;}
90%{ -webkit-transform:translateY(-2%); opacity:1;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToTopTan{
0%{ transform:translateY(100%); opacity:0;}
70%{ transform:translateY(-5%); opacity:1;}
80%{ transform:translateY(2%); opacity:1;}
90%{ transform:translateY(-2%); opacity:1;}
100%{ transform:translateY(0); opacity:1;}
}
/*向下移動并彈性顯示*/
@-webkit-keyframes fadeToDownTan{
0%{ -webkit-transform:translateY(-100%); opacity:0;}
70%{ -webkit-transform:translateY(5%); opacity:1;}
80%{ -webkit-transform:translateY(-2%); opacity:1;}
90%{ -webkit-transform:translateY(2%); opacity:1;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToDownTan{
0%{ transform:translateY(-100%); opacity:0;}
70%{ transform:translateY(5%); opacity:1;}
80%{ transform:translateY(-2%); opacity:1;}
90%{ transform:translateY(2%); opacity:1;}
100%{ transform:translateY(0); opacity:1;}
}
/*從大向小變化彈性顯示*/
@-webkit-keyframes fadeInMaxToMinTan{
0%{ -webkit-transform:scale(2); opacity:0;}
70%{ -webkit-transform:scale(.9); opacity:1;}
85%{ -webkit-transform:scale(1.1); opacity:1;}
100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMaxToMinTan{
0%{ transform:scale(2); opacity:0;}
70%{ transform:scale(.9); opacity:1;}
85%{ transform:scale(1.1); opacity:1;}
100%{ transform:scale(1); opacity:1;}
}
/*從小向大變化彈性顯示*/
@-webkit-keyframes fadeInMinToMaxTan{
0%{ -webkit-transform:scale(0); opacity:0;}
70%{ -webkit-transform:scale(1.1); opacity:1;}
85%{ -webkit-transform:scale(.9); opacity:1;}
100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMinToMaxTan{
0%{ transform:scale(0); opacity:0;}
70%{ transform:scale(1.1); opacity:1;}
85%{ transform:scale(.9); opacity:1;}
100%{ transform:scale(1); opacity:1;}
}
/**********************************/
/*向左移動顯示*/
@-webkit-keyframes fadeToLeft{
0%{ -webkit-transform:translateX(100%); opacity:0;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeToLeft{
0%{ transform:translateX(100%); opacity:0;}
100%{ transform:translateX(0); opacity:1;}
}
/*向右移動顯示*/
@-webkit-keyframes fadeToRight{
0%{ -webkit-transform:translateX(-100%); opacity:0;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeToRight{
0%{ transform:translateX(-100%); opacity:0;}
100%{ transform:translateX(0); opacity:1;}
}
/*向上移動顯示*/
@-webkit-keyframes fadeToTop{
0%{ -webkit-transform:translateY(100%); opacity:0;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToTop{
0%{ transform:translateY(100%); opacity:0;}
100%{ transform:translateY(0); opacity:1;}
}
/*向上60移動顯示*/
@-webkit-keyframes fadeToTop60{
0%{ -webkit-transform:translateY(60px); opacity:0;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToTop60{
0%{ transform:translateY(60px); opacity:0;}
100%{ transform:translateY(0); opacity:1;}
}
/*向下移動顯示*/
@-webkit-keyframes fadeToDown{
0%{ -webkit-transform:translateY(-100%); opacity:0;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToDown{
0%{ transform:translateY(-100%); opacity:0;}
100%{ transform:translateY(0); opacity:1;}
}
/*向下60移動顯示*/
@-webkit-keyframes fadeToDown60{
0%{ -webkit-transform:translateY(-60px); opacity:0;}
100%{ -webkit-transform:translateY(0); opacity:1;}
}
@keyframes fadeToDown60{
0%{ transform:translateY(-60px); opacity:0;}
100%{ transform:translateY(0); opacity:1;}
}
/**********************************/
/*上下微移漂浮*/
@-webkit-keyframes flashTopDown{
0%{ -webkit-transform:translateY(0); opacity:1;}
100%{ -webkit-transform:translateY(8px); opacity:.8;}
}
@keyframes flashTopDown{
0%{ transform:translateY(0); opacity:1;}
100%{ transform:translateY(8px); opacity:.8;}
}
/**********************************/
/*從大向小變化顯示*/
@-webkit-keyframes fadeInMaxToMin{
0%{ -webkit-transform:scale(2); opacity:0;}
100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMaxToMin{
0%{ transform:scale(2); opacity:0;}
100%{ transform:scale(1); opacity:1;}
}
/*從小向大變化顯示*/
@-webkit-keyframes fadeInMinToMax{
0%{ -webkit-transform:scale(0); opacity:0;}
100%{ -webkit-transform:scale(1); opacity:1;}
}
@keyframes fadeInMinToMax{
0%{ transform:scale(0); opacity:0;}
100%{ transform:scale(1); opacity:1;}
}
/**********************************/
/*大小閃動變化 變小*/
@-webkit-keyframes flashMaxMin{
0%{ -webkit-transform:scale(1);}
100%{ -webkit-transform:scale(.98);}
}
@keyframes flashMaxMin{
0%{ transform:scale(1);}
100%{ transform:scale(.98);}
}
/*大小閃動變化變大*/
@-webkit-keyframes flashMax{
0%{ -webkit-transform:scale(1);}
100%{ -webkit-transform:scale(1.05);}
}
@keyframes flashMax{
0%{ transform:scale(1);}
100%{ transform:scale(1.05);}
}
/**********************************/
/*漸顯*/
@-webkit-keyframes fadeIn{
0%{ opacity:0;}
100%{ opacity:1;}
}
@keyframes fadeIn{
0%{ opacity:0;}
100%{ opacity:1;}
}
/*漸隱*/
@-webkit-keyframes fadeOut{
0%{ opacity:1;}
100%{ opacity:0;}
}
@keyframes fadeOut{
0%{ opacity:1;}
100%{ opacity:0;}
}
前端開發,移動端公共樣式
/* 禁用iPhone中Safari的字號自動調整 */
html {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
/* 解決IOS默認滑動很卡的情況 */
-webkit-overflow-scrolling : touch;
}
/* 禁止縮放表單 */
input[type="submit"], input[type="reset"], input[type="button"], input {
resize: none;
border: none;
}
/* 取消鏈接高亮 */
body, div, ul, li, ol, h2, h3, h4, h5, h6, h7, input, textarea, select, p, dl, dt, dd, a, img, button, form, table, th, tr, td, tbody, article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* 設置HTML5元素為塊 */
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
display: block;
}
/* 圖片自適應 */
img {
width: 100%;
height: auto;
width: auto9; /* ie8 */
display: block;
-ms-interpolation-mode: bicubic;/*為了照顧ie圖片縮放失真*/
}
/* 初始化 */
body, div, ul, li, ol, h2, h3, h4, h5, h6, h7, input, textarea, select, p, dl, dt, dd, a, img, button,
form, table, th, tr, td, tbody, article, aside, details, figcaption, figure, footer, header, hgroup,
menu, nav, section {
margin: 0;
padding: 0;
}
body {
font: 12px/1.5 'Microsoft YaHei','宋體', Tahoma, Arial, sans-serif;
color: #fff;
background-color: #F7F7F7;
}
em, i {
font-style: normal;
}
ul,li{
list-style-type: none;
}
strong {
font-weight: normal;
}
table{
border-collapse:collapse;
border-spacing:0
}
textarea {
resize:none; /*禁用了文本的拖拉,尤其在谷歌下*/
}
p {
word-wrap:break-word; /* 不夠的單詞自動換行 而不會被截掉 */
}
.clearfix:after {
content: "";
display: block;
visibility: hidden;
height: 0;
clear: both;
}
.clearfix {
zoom: 1;
}
a {
text-decoration: none;
color: #fff;
font-family: 'Microsoft YaHei', Tahoma, Arial, sans-serif;
}
a:hover {
text-decoration: none;
}
ul, ol {
list-style: none;
}
h2, h3, h4, h5, h6, h7 {
font-size: 100%;
font-family: 'Microsoft YaHei';
}
img {
border: none;
}
input{
font-family: 'Microsoft YaHei';
}
/*單行溢出*/
.one-txt-cut{
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
/*多行溢出 手機端使用*/
.txt-cut{
overflow : hidden;
text-overflow: ellipsis;
display: -webkit-box;
/* -webkit-line-clamp: 2; */
-webkit-box-orient: vertical;
}
/* 移動端點擊a鏈接出現藍色背景問題解決 */
a:link,a:active,a:visited,a:hover {
background: none;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-tap-highlight-color: transparent;
}
.overflow {overflow:hidden; }
.w50{
width: 50%;
}
.w25{
width: 25%;
}
.w20{
width: 20%;
}
.w33{
width: 33.333333%;
}
.fl{
float: left;
}
.fr{
float: right;
}
.db{
display: block !important;
}
.dn{
display: none;
}
/* 附加 */
到此,關于“前端開發常用CSS動畫代碼有哪些”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。