script.aculo.us的Effect.DropOut()方法用於從DOM中刪除並顯示模擬下拉效果的元素。將核心效果Effect.MoveBy()和effect.Opacity()組合在一起以生成DroupOut效果。它可以與Effect.Appear()一起實現,以刪除元素,然後再次顯示它。
用法:
new Effect.DropOut(element_id, {options});
此效果不需要任何特定參數。可以使用視覺效果模塊的常用參數。
例:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="prototype.js">
</script>
<script type="text/javascript"
src="scriptaculous.js">
</script>
<script type="text/javascript">
function ShowElement(element) {
new Effect.Appear(element, { duration:1 });
}
function HideElement(element) {
new Effect.DropOut(element, { duration:3 });
}
</script>
</head>
<body>
<div onclick="ShowElement('element')">
<Button>Show Content</Button>
</div>
<br />
<div onclick="HideElement('element')">
<Button>Hide Content</Button>
</div>
<br />
<img id="element" src="GEEKSIMAGES/gfg.png">
</body>
</html>
輸出:
相關用法
注:本文由純淨天空篩選整理自swapnil074大神的英文原創作品 script.aculo.us DropOut Effect。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。