.<a href='[field:arcurl /]'><img src='[field:litpic/]' border='0' width='' height=''></a>
2.[field:imglink /]
3.<a href='[field:arcurl /]'> [field:image/]</a>
說明:
[field:imglink /]與<a href='[field:arcurl /]'>[field:image/]</a> 是完全等價(jià)的,只不過后者更靈活一點(diǎn),可以在 <a>中添加 title=""
即
<a href='[field:arcurl /]' title="[field:title function='htmlspecialchars(@me)'/] ">[field:image/]</a>
以下代碼則更為靈活,不僅可以添加title="",還可以添加 alt="",但是雖然靈活了,缺少了圖片的寬度和高度的控制,所以要在CSS中控制圖片的大小,適合對CSS有一點(diǎn)了解的人。
<a href='[field:arcurl /]' title="[field:title function='htmlspecialchars(@me)'/] "><img src='[field:litpic/]' border='0' width='' height='' alt="[field:title function='htmlspecialchars(@me)'/] "></a>
在文章內(nèi)容頁加入圖片標(biāo)簽:<img src="{dede:field name="litpic"/}" border="0">
在系統(tǒng)還原后,重新更新欄目或文件的時(shí)候,會出現(xiàn)一些錯(cuò)誤提示:沒有該欄目數(shù)據(jù)可能緩存文件。
基本做法:
1.把inc_catalog_base.inc緩存文件刪掉;
2.更新系統(tǒng)緩存,點(diǎn)“生成—>更新系統(tǒng)緩存—>開始執(zhí)行”;
3.然后重新生成欄目,
如果以上解決不了。
嘗試一般性的解決方案:
在網(wǎng)站后臺,點(diǎn)擊左側(cè)“核心”—“網(wǎng)站欄目管理”;
登錄ftp,找到data/cache目錄,刪掉inc_catalog_base.inc文件
打開dede目錄,找到config.php文件打開,查找
$fp1Header = "<{$phph}php\r\nglobal$_Cs;\r\n$_Cs=array();\r\n";修改為:
$fp1Header = "<{$phph}php\r\nglobal$cfg_Cs;\r\n$cfg_Cs=array();\r\n";
fwrite($fp1,"$_Cs[{$row->id}]=array({$row->reid},{$row->channeltype},{$row->issend});\r\n");修改為:
fwrite($fp1,"$cfg_Cs[{$row->id}]=array({$row->reid},{$row->channeltype},{$row->issend});\r\n");
4.最后更新系統(tǒng)緩存,一鍵生成HTML文件。
麗炫酷的動畫特效總能夠讓人心曠神怡,不能自已。艷羨之余,如果還能夠探究其華麗外表下的實(shí)現(xiàn)邏輯,那就是百尺竿頭,更上一步了。本次我們使用圖片、SCSS樣式以及SVG圖片動畫來實(shí)現(xiàn)“點(diǎn)贊”按鈕的動畫特效,并比較不同之處。
最簡單,也最容易理解的實(shí)現(xiàn)方式就是使用圖片。曾幾何時(shí),幾乎所有前端特效都需要借助圖片來完成。
實(shí)現(xiàn)原理很簡單,通過不同的關(guān)鍵幀來“拼接”一段完整的動畫影片,每一幀即該動畫的每一個(gè)瞬間“狀態(tài)”。
首先聲明必要的盒子模型:
<div class="heart"></div>
這里以div為例子,聲明偽類對象heart。
隨后通過樣式對heart偽類進(jìn)行控制:
.heart {
cursor: pointer;
height: 50px;
width: 50px;
background-image:url( 'https://abs.twimg.com/a/1446542199/img/t1/web_heart_animation.png');
background-position: left;
background-repeat:no-repeat;
background-size:2900%;
}
.heart:hover {
background-position:right;
}
.is_animating {
animation: heart-burst .8s steps(28) 1;
}
@keyframes heart-burst {
from {background-position:left;}
to { background-position:right;}
}
這里指定背景圖片位置,只顯示最左側(cè)的背景元素,鼠標(biāo)懸停時(shí)則只顯示最右側(cè)背景元素,然后當(dāng)鼠標(biāo)點(diǎn)擊div時(shí),觸發(fā)@keyframes heart-burst動畫,從左側(cè)移動至右側(cè),一共進(jìn)行28幀的側(cè)移動作:
這樣就完成了一段流暢的動畫特效:
需要注意的是,這里需要借助JavaScript綁定單擊事件,所以需要引入zepto.min.js文件
https://cdnjs.cloudflare.com/ajax/libs/zepto/1.2.0/zepto.min.js
通過zepto.min.js庫就可以很方便的操作頁面節(jié)點(diǎn):
$(".heart").on('click touchstart', function(){
$(this).toggleClass('is_animating');
});
$(".heart").on('animationend', function(){
$(this).toggleClass('is_animating');
});
邏輯是單擊事件觸發(fā)動畫,動畫執(zhí)行過程中再次點(diǎn)擊則移除動畫效果。
此種方式依賴多幀背景圖、CSS動畫以及JavaScript事件綁定,顯然成本有些高,同時(shí)多幀圖片平鋪導(dǎo)致體積過大,也會占用系統(tǒng)帶寬,得不償失。
使用純CSS樣式也可以完成這樣的特效,但CSS3原生語法太過復(fù)雜,這里我們使用SCSS語法,SCSS是 CSS3的超集,在保證兼容性的前提下,允許使用變量、 嵌套、 混合、導(dǎo)入等特性, 在編寫邏輯復(fù)雜的CSS代碼時(shí),可以簡化邏輯,提高CSS的代碼可讀性。
首先還是創(chuàng)建基本盒子模型:
<input id="toggle-heart" type="checkbox"/>
<label for="toggle-heart">?</label>
這里通過復(fù)選框和標(biāo)簽元素來控制點(diǎn)贊按鈕的狀態(tài)。
隨后編寫SCSS邏輯:
$bubble-d: 4.5rem; // bubble diameter
$bubble-r: .5*$bubble-d; // bubble-radius
@mixin bubble($ext) {
transform: scale(1);
border-color: #cc8ef5;
border-width: $ext;
}
body {
display: flex;
justify-content: center;
margin: 0;
height: 100vh;
}
[id='toggle-heart'] {
position: absolute;
left: -100vw;
&:checked + label {
color: #e2264d;
will-change: font-size;
animation: heart 1s cubic-bezier(.17, .89, .32, 1.49);
&:before, &:after {
animation: inherit;
animation-timing-function: cubic-bezier(.21, .61, .35, 1);
}
&:before {
will-change: transform, border-width, border-color;
animation-name: bubble;
}
}
}
[for='toggle-heart'] {
align-self: center;
position: relative;
color: #aab8c2;
font-size: 2em;
cursor: pointer;
&:before, &:after {
position: absolute;
z-index: -1;
top: 50%; left: 50%;
border-radius: 50%;
content: '';
}
&:before {
box-sizing: border-box;
margin: -$bubble-r;
border: solid $bubble-r #e2264d;
width: $bubble-d; height: $bubble-d;
transform: scale(0);
}
}
@keyframes heart {
0%, 17.5% { font-size: 0; }
}
@keyframes bubble {
15% { @include bubble($bubble-r); }
30%, 100% { @include bubble(0); }
}
這里首先將復(fù)選框按鈕移出界面,隨后定義bubble對象,這里bubble指的是點(diǎn)擊后膨脹的紫色(#cc8ef5)泡泡,直徑是4.5rem,并且圓角修飾:$bubble-r: .5*$bubble-d
隨后通過id選擇器toggle-heart狀態(tài)判斷元素狀態(tài),觸發(fā)heart和bubble動畫,在一秒內(nèi)動態(tài)的改變heart元素以及bubble元素的位置、大小以及邊框透明度,從而完成動態(tài)特效。
接著添加煙花特效:
body {
display: flex;
justify-content: center;
margin: 0;
height: 100vh;
background: linear-gradient(135deg, #121721, #000);
font: 1em verdana, sans-serif;
}
[id='toggle-heart'] {
position: absolute;
left: -100vw;
}
[id='toggle-heart']:checked + label {
color: #e2264d;
filter: none;
will-change: font-size;
-webkit-animation: heart 1s cubic-bezier(0.17, 0.89, 0.32, 1.49);
animation: heart 1s cubic-bezier(0.17, 0.89, 0.32, 1.49);
}
[id='toggle-heart']:checked + label:before, [id='toggle-heart']:checked + label:after {
-webkit-animation: inherit;
animation: inherit;
-webkit-animation-timing-function: ease-out;
animation-timing-function: ease-out;
}
[id='toggle-heart']:checked + label:before {
will-change: transform, border-width, border-color;
-webkit-animation-name: bubble;
animation-name: bubble;
}
[id='toggle-heart']:checked + label:after {
will-change: opacity, box-shadow;
-webkit-animation-name: sparkles;
animation-name: sparkles;
}
[id='toggle-heart']:focus + label {
text-shadow: 0 0 3px white, 0 1px 1px white, 0 -1px 1px white, 1px 0 1px white, -1px 0 1px white;
}
[for='toggle-heart'] {
align-self: center;
position: relative;
color: #888;
font-size: 2em;
filter: grayscale(1);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
cursor: pointer;
}
[for='toggle-heart']:before, [for='toggle-heart']:after {
position: absolute;
z-index: -1;
top: 50%;
left: 50%;
border-radius: 50%;
content: '';
}
[for='toggle-heart']:before {
box-sizing: border-box;
margin: -2.25rem;
border: solid 2.25rem #e2264d;
width: 4.5rem;
height: 4.5rem;
transform: scale(0);
}
[for='toggle-heart']:after {
margin: -0.1875rem;
width: 0.375rem;
height: 0.375rem;
box-shadow: 0.32476rem -3rem 0 -0.1875rem #ff8080, -0.32476rem -2.625rem 0 -0.1875rem #ffed80, 2.54798rem -1.61656rem 0 -0.1875rem #ffed80, 1.84982rem -1.89057rem 0 -0.1875rem #a4ff80, 2.85252rem 0.98418rem 0 -0.1875rem #a4ff80, 2.63145rem 0.2675rem 0 -0.1875rem #80ffc8, 1.00905rem 2.84381rem 0 -0.1875rem #80ffc8, 1.43154rem 2.22414rem 0 -0.1875rem #80c8ff, -1.59425rem 2.562rem 0 -0.1875rem #80c8ff, -0.84635rem 2.50595rem 0 -0.1875rem #a480ff, -2.99705rem 0.35095rem 0 -0.1875rem #a480ff, -2.48692rem 0.90073rem 0 -0.1875rem #ff80ed, -2.14301rem -2.12438rem 0 -0.1875rem #ff80ed, -2.25479rem -1.38275rem 0 -0.1875rem #ff8080;
}
@-webkit-keyframes heart {
0%, 17.5% {
font-size: 0;
}
}
@keyframes heart {
0%, 17.5% {
font-size: 0;
}
}
@-webkit-keyframes bubble {
15% {
transform: scale(1);
border-color: #cc8ef5;
border-width: 2.25rem;
}
30%, 100% {
transform: scale(1);
border-color: #cc8ef5;
border-width: 0;
}
}
@keyframes bubble {
15% {
transform: scale(1);
border-color: #cc8ef5;
border-width: 2.25rem;
}
30%, 100% {
transform: scale(1);
border-color: #cc8ef5;
border-width: 0;
}
}
@-webkit-keyframes sparkles {
0%, 20% {
opacity: 0;
}
25% {
opacity: 1;
box-shadow: 0.32476rem -2.4375rem 0 0rem #ff8080, -0.32476rem -2.0625rem 0 0rem #ffed80, 2.1082rem -1.26585rem 0 0rem #ffed80, 1.41004rem -1.53985rem 0 0rem #a4ff80, 2.30412rem 0.85901rem 0 0rem #a4ff80, 2.08305rem 0.14233rem 0 0rem #80ffc8, 0.76499rem 2.33702rem 0 0rem #80ffc8, 1.18748rem 1.71734rem 0 0rem #80c8ff, -1.35019rem 2.0552rem 0 0rem #80c8ff, -0.60229rem 1.99916rem 0 0rem #a480ff, -2.44865rem 0.22578rem 0 0rem #a480ff, -1.93852rem 0.77557rem 0 0rem #ff80ed, -1.70323rem -1.77366rem 0 0rem #ff80ed, -1.81501rem -1.03204rem 0 0rem #ff8080;
}
}
@keyframes sparkles {
0%, 20% {
opacity: 0;
}
25% {
opacity: 1;
box-shadow: 0.32476rem -2.4375rem 0 0rem #ff8080, -0.32476rem -2.0625rem 0 0rem #ffed80, 2.1082rem -1.26585rem 0 0rem #ffed80, 1.41004rem -1.53985rem 0 0rem #a4ff80, 2.30412rem 0.85901rem 0 0rem #a4ff80, 2.08305rem 0.14233rem 0 0rem #80ffc8, 0.76499rem 2.33702rem 0 0rem #80ffc8, 1.18748rem 1.71734rem 0 0rem #80c8ff, -1.35019rem 2.0552rem 0 0rem #80c8ff, -0.60229rem 1.99916rem 0 0rem #a480ff, -2.44865rem 0.22578rem 0 0rem #a480ff, -1.93852rem 0.77557rem 0 0rem #ff80ed, -1.70323rem -1.77366rem 0 0rem #ff80ed, -1.81501rem -1.03204rem 0 0rem #ff8080;
}
}
新增sparkles對象,通過動態(tài)的控制元素的彩色陰影來表現(xiàn)點(diǎn)擊后的煙花動態(tài)效果:
這里為了增加效果對比度,將背景設(shè)置為深色,同時(shí)為點(diǎn)贊按鈕增加亮色邊框:
[id='toggle-heart']:focus + label {
text-shadow:
0 0 3px #fff,
0 1px 1px #fff, 0 -1px 1px #fff,
1px 0 1px #fff, -1px 0 1px #fff;
}
大體上,利用transform屬性控制元素的絕對定位、顏色、邊框以及盒子模型陰影來完成此種特效,帶寬資源占用層面,明顯比圖片更具優(yōu)勢。
SVG是矢量圖形,不受像素的影響,從而使得它在不同的平臺或者媒體下表現(xiàn)出的兼容性更好,與此同時(shí),SVG對動畫的支持較好,其DOM結(jié)構(gòu)可以被其特定語法或者CSS控制,從而輕松的實(shí)現(xiàn)動畫效果。
首先依然聲明盒子模型:
<label class="like">
<input type="checkbox"/>
<div class="hearth"/>
</label>
隨后定義樣式:
:root {
--size: 100px;
--frames: 62;
}
html {
background-color: #15202B;
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
user-select: none;
}
input {
display: none;
}
.like {
display: block;
width: var(--size);
height: var(--size);
cursor: pointer;
border-radius: 999px;
overflow: visible;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
}
.hearth {
background-image: url('https://assets.codepen.io/23500/Hashflag-AppleEvent.svg');
background-size: calc(var(--size) * var(--frames)) var(--size);
background-repeat: no-repeat;
background-position-x: calc(var(--size) * (var(--frames) * -1 + 2));
background-position-y: calc(var(--size) * 0.02);
width: var(--size);
height: var(--size);
}
input:checked + .hearth {
animation: like 1s steps(calc(var(--frames) - 3));
animation-fill-mode: forwards;
}
@keyframes like {
0% {
background-position-x: 0;
}
100% {
background-position-x: calc(var(--size) * (var(--frames) * -1 + 3));
}
}
@media (hover: hover) {
.like:hover {
background-color: #E1255E15;
.hearth {
background-position-x: calc(var(--size) * (var(--frames) * -1 + 1));
}
}
}
和普通圖片如出一轍,通過background-image來控制背景SVG圖片的順序,對背景的橫坐標(biāo)進(jìn)行側(cè)移動畫操作,只不過幀數(shù)提高到62幀:
可以看到這里通過input:checked狀態(tài)就可以觸發(fā)@keyframes like橫移動畫,并不需要單獨(dú)撰寫JavaScript邏輯。
三種動畫特效實(shí)現(xiàn)方式各有千秋,但從可維護(hù)性以及成本控制角度上看,SCSS顯然是最優(yōu)解。
源:【人民日報(bào)中央廚房-商海觀潮工作室】
珠江岸邊,琶洲會展中心再次迎來八方賓客。第133屆中國進(jìn)出口商品交易會(廣交會)全面恢復(fù)線下展,于4月15日起分3期舉辦至5月5日,同時(shí)全年常態(tài)化線上運(yùn)營。
從家用電器、五金建材、化工產(chǎn)品等傳統(tǒng)展品,到新增設(shè)的工業(yè)自動化及智能制造展區(qū)、新能源及智能網(wǎng)聯(lián)汽車展區(qū)和智慧生活專區(qū)等,行走廣交會場館,目不暇接的精彩展品和持續(xù)火熱的旺盛人氣,彰顯著中國經(jīng)濟(jì)的活力和韌性。
這是歷史上規(guī)模最大的一屆廣交會。本屆廣交會啟用新展館,第一期展覽面積由原來的40萬平方米增加到50萬平方米。4月19日,本屆廣交會一期閉幕,截至19日下午6時(shí),進(jìn)館126.1萬人次。展覽面積和進(jìn)館人次均創(chuàng)歷史新高。同時(shí),常態(tài)化運(yùn)營線上平臺,線上參會境外采購商31.1萬人。
廣交會琶洲會展中心里人流涌動。(新華社記者 劉大偉 攝)
這是洽談火熱、下單積極的一屆廣交會。本屆廣交會一期到會境外采購商6.6萬人,出口成交128億美元。不少參展企業(yè)表示,盡管境外采購商還在恢復(fù)之中,但到會采購商采購意愿強(qiáng)、下單更快。從訂單數(shù)量看,3個(gè)月以上的中長單占比接近六成。除現(xiàn)場下單外,很多客商還向參展企業(yè)預(yù)約實(shí)地看廠,未來有望達(dá)成更多合作。
幾名來自哥倫比亞的采購商在廣交會上了解中國汽配產(chǎn)品。(新華社記者 劉大偉 攝)
這是新題材新展品眾多的一屆廣交會。本屆廣交會一期新設(shè)工業(yè)自動化及智能制造、新能源及智能網(wǎng)聯(lián)汽車、智慧生活等題材,共吸引762家企業(yè)參展。舉辦新品首發(fā)首展首秀活動150場,涉及工業(yè)制造、電子家電、建材家裝等行業(yè),線上線下吸引3萬人次觀看。第一期線上展品78.4萬件,其中新產(chǎn)品接近15.1萬件、綠色低碳產(chǎn)品14.3萬件、智能產(chǎn)品9.6萬件、自主知識產(chǎn)權(quán)產(chǎn)品9.5萬件。
采購商在廣交會新設(shè)置的新能源及智能網(wǎng)聯(lián)汽車展區(qū)了解中國新能源汽車產(chǎn)品。(新華社記者 劉大偉 攝)
這是綠色發(fā)展引領(lǐng)潮流的一屆廣交會。電動汽車、光伏、動力電池等“新三樣”產(chǎn)品集中亮相,吸引了大批采購商詢價(jià)洽談。展出零碳源空調(diào)、光伏儲能設(shè)備等低碳環(huán)保展品約50萬件。
“發(fā)展經(jīng)濟(jì)最重要的是人來人往。規(guī)模盛大的廣交會呈現(xiàn)供需兩旺的態(tài)勢,一方面展示了中國經(jīng)濟(jì)復(fù)蘇的強(qiáng)勁勢頭,另一方面也印證了世界各國對于中國經(jīng)濟(jì)發(fā)展的堅(jiān)定信心?!边|寧大學(xué)校長余淼杰表示。
廣交會現(xiàn)場的火熱氛圍也讓不少外貿(mào)企業(yè)感到振奮。在新寶股份總裁曾展暉看來,眾多海外客商來往交流,正是海外市場逐步恢復(fù)的一個(gè)表現(xiàn),他對今年的外貿(mào)行業(yè)發(fā)展充滿期待和信心?!皻W美市場的需求逐步在恢復(fù),同時(shí)我們拓展了很多新品類,做了很多布局,從未來的國際市場來看,今年到明年的市場增長預(yù)期很大?!?/p>
今年一季度,我國貨物貿(mào)易進(jìn)出口總值9.89萬億元,同比增長4.8%,也讓曾展暉感慨,“看到了一個(gè)復(fù)蘇的曙光”。
在這場萬商云集盛會里,無數(shù)外貿(mào)人步履堅(jiān)定再出發(fā)。
(人民日報(bào)中央廚房—商海觀潮工作室)
本文來自【人民日報(bào)中央廚房-商海觀潮工作室】,僅代表作者觀點(diǎn)。全國黨媒信息公共平臺提供信息發(fā)布傳播服務(wù)。
ID:jrtt
*請認(rèn)真填寫需求信息,我們會在24小時(shí)內(nèi)與您取得聯(lián)系。