border動(dòng)畫(huà)效果不顯示
<!DOCTYPE html>
<html>
<head>
? ? <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
? ? <title></title>
? ? <style>
? ? p {
? ? ? ? color: red;
? ? }
? ? div{
? ? ? ? width:200px;?
? ? ? ? height: 100px;?
? ? ? ? background-color: yellow;
? ? ? ? color:red;
? ? ? ? border:2px dashed red;
? ? }
? ? </style>
? ? <script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
</head>
<body>
? ? <h2>animate(上)</h2>
? ? <p>慕課網(wǎng),專注分享</p>
? ? <div id="aaron">內(nèi)部動(dòng)畫(huà)</div>
? ? 點(diǎn)擊觀察動(dòng)畫(huà)效果:
? ? <select id="animation">
? ? ? ? <option value="1">動(dòng)畫(huà)1</option>
? ? ? ? <option value="2">動(dòng)畫(huà)2</option>
? ? ? ? <option value="3">動(dòng)畫(huà)3</option>
? ? ? ? <option value="4">動(dòng)畫(huà)4</option>
? ? </select>
? ? <input id="exec" type="button" value="執(zhí)行動(dòng)畫(huà)">
? ? <script type="text/javascript">
? ? $("#exec").click(function() {
? ? ? ? var v = $("#animation").val();
? ? ? ? var $aaron = $("#aaron");
? ? ? ? if (v == "1") {
? ? ? ? ? ? // 數(shù)值的單位默認(rèn)是px
? ? ? ? ? ? $aaron.animate({
? ? ? ? ? ? ? ? width ?:300,
? ? ? ? ? ? ? ? height :300,
? ? ? ? ? ? ? ? border:'4px solid red'
? ? ? ? ? ? });
? ? ? ? } else if (v == "2") {
? ? ? ? ? ? // 在現(xiàn)有高度的基礎(chǔ)上增加100px
? ? ? ? ? ? $aaron.animate({
? ? ? ? ? ? ? ? ?width ?: "+=100px",
? ? ? ? ? ? ? ? ?height : "+=100px"
? ? ? ? ? ? });
? ? ? ? } else if (v == "3") {
? ? ? ? ? ? $aaron.animate({
? ? ? ? ? ? ? ? fontSize: "5em"
? ? ? ? ? ? }, 2000, function() {
? ? ? ? ? ? ? ? alert("動(dòng)畫(huà) fontSize執(zhí)行完畢!");
? ? ? ? ? ? });
? ? ? ? } else if (v == "4") {
? ? ? ? ? ? //通過(guò)toggle參數(shù)切換高度
? ? ? ? ? ? $aaron.animate({
? ? ? ? ? ? ? ? width: "toggle"
? ? ? ? ? ? });
? ? ? ? }?
? ? });
? ? </script>
</body>
</html>
如動(dòng)畫(huà)一,為什么樣式里面加了border,不顯示borde動(dòng)畫(huà)效果呢
2017-01-13
所有用于動(dòng)畫(huà)的屬性必須是數(shù)字的,你這里這么寫(xiě)border:'4px solid red',邊框的顏色和類型不是數(shù)值類型的
2017-01-13
課程里面說(shuō)border也能產(chǎn)生動(dòng)畫(huà)效果,應(yīng)該怎么樣做borde的動(dòng)畫(huà)呢