❶ js或是jquery代碼怎麼寫讓圖片在一個div里實現由遠到近的漸變效果,即圖片慢慢放大,超出div的部分不顯示
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
<title>demo</title>
<script src="jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
</head>
<style type="text/css">
body{
margin:0;
padding:0;
}
div{
width:500px;
height:300px;
border:1px solid red;
overflow:hidden;
margin:0 auto;
}
img{
width:0;
height:0;
margin-left:250px;
margin-top:150px;
padding:0;
}
</style>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$('#img').animate({
width:"200%",
height:"200%",
marginLeft:"-200px",
marginTop:"-100px"
},10000);
});
</script>
<body>
<div class="showimg" id="showimg">
<img src="3.jpg" id="img" alt="Here is a pic" />
</div>
</body>
</html>
數值未經過計算,隨便寫的
❷ 如何用js實現div的背景顏色漸變求解答
CSS3 的linear-gradient 屬性滿足你的需求
❸ 如何生成顏色漸變的柱狀圖 js
1.首先繪制好柱復形圖。
2.然後制雙擊圖中的任意一個柱子,彈出屬性框,右側選中Pattern。
3.將Pattern選項卡下Fill中的Color設置為Indivial Color(純色)-White。
本例中是「白色向紅色的漸變模式」,所以主體色為白色(即柱子中間的部分是白色)。
4.將Pattern選項卡下Gradient Fill(漸變填充)中的Mode(方式)設置為Two Colors。(因為是兩個顏色間漸變)
❹ jquery.rotate.js庫中的rotate函數怎麼用。
rotate是jQuery旋轉rotate插件,支持Internet Explorer 6.0+、Firefox 2.0、Safari 3、Opera 9、Google Chrome,高級瀏覽器下使用Transform,低版本ie使用VML實現。
rotate(angle)angle參數:[Number] – 默認為 0
根據給定的角度旋轉圖片例如:
$(「#img」).rotate(45);或$(『#img』).rotate({angle:45})
rotate(parameters)parameters參數:[Object]包含旋轉參數的對象。
支持的屬性:
1.angle屬性:[Number]– default 0 –旋轉的角度數,並且立即執行
例如:1$(「#img」).rotate({angle:45});
2.bind屬性:[Object]對象,包含綁定到一個旋轉對象的事件。事件內部的$(this)指向旋轉對象-這樣可以在內部鏈式調用- $(this).rotate(…)。
例如(clickonarrow):
$(「#img」).rotate({bind:{
click:function(){
$(this).rotate({
angle:0,
animateTo:180
})
}
}
});
3.animateTo屬性:[Number]– default 0 –從當前角度值動畫旋轉到給定的角度值(或給定的角度參數)
4.ration屬性:[Number]–指定使用animateTo的動畫執行持續時間
例如(clickonarrow):
$(「#img」).rotate({bind:{
click:function(){
$(this).rotate({
ration:6000,
angle:0,
animateTo:100
})
}
}
});
5.step屬性:[Function]–每個動畫步驟中執行的回調函數,當前角度值作為該函數的第一個參數
6.easing屬性:[Function]–默認(see below)
默認:function(x,t,b,c,d){ return -c *((t=t/d-1)*t*t*t - 1)+ b; }
Where:
t:current time,
b:begInnIng value,
c:change In value,
d:ration,
x:unused
沒有漸變:No easing(linear easing):function(x,t,b,c,d){ return(t/d)*c ; }
示例1:沒有效果,一直轉
$("#scImg").rotate({
angle:0,
animateTo:360,
callback:rotation,
easing:function(x,t,b,c,d){
return(t/d)*c;
}
});
示例2:默認的效果
$("#scImg").rotate({
angle:0,
animateTo:360,
callback:rotation,
easing:function(x,t,b,c,d){
return-c*((t=t/d-1)*t*t*t-1)+b;
}
});
示例3:
$(「#img」).rotate({bind:{
click:function(){
$(this).rotate({
angle:0,
animateTo:180,
easing:$.easing.easeInOutElastic
})
}
}
});
7.callback屬性:[Function]動畫完成時執行的回調函數
例如
$(「#img」).rotate({bind:{
click:function(){
$(this).rotate({
angle:0,
animateTo:180,
callback:function(){alert(1)}
})
}
}
});
8.getRotateAngle這個函數只是簡單地返迴旋轉對象當前的角度。
例如:
$(「#img」).rotate({
angle:45,
bind:{
click:function(){
alert($(this).getRotateAngle());
}
}
});
9.stopRotate這個函數只是簡單地停止正在進行的旋轉動畫。例如:
$(「#img」).rotate({
bind:{
click:function(){
$(「#img」).rotate({
angle:0,
animateTo:180,
ration:6000
});
setTimeout(function(){
$(「#img」).stopRotate();
},1000);
}
}
});
❺ 什麼是JS特效
JS特效就是網頁中實現來的特殊效果自或者特殊的功能的一種技術,是用網頁腳本(javascript)來編寫製作動態特殊效果。
比如圖片切換,漸變等等,它為網頁活躍了網頁的氣氛,有時候會起到一定的親切力。
JavaScript 是根據 "ECMAScript"標准制定的網頁腳本語言。這個標准由 ECMA 組織發展和維護。ECMA-262 是正式的 JavaScript 標准。
(5)js的圖片漸變擴展閱讀:
能夠具有交互性,能夠包含更多活躍的元素,就有必要在網頁中嵌入其它的技術。如:Javascript、VBScript、Document Object Model(DOM,文檔對象模型)、Layers和 Cascading Style Sheets(CSS,層疊樣式表)。
JavaScript 使網頁增加互動性。JavaScript 使有規律地重復的HTML文段簡化,減少下載時間。JavaScript 能及時響應用戶的操作,對提交表單做即時的檢查,無需浪費時間交由 CGI 驗證。JavaScript 的特點是無窮無盡的,只要你有創意。