למה הפונקציה הזאת קודם משנה צבע ורק אחרי זה היא מבצעת פקודות ולא קודם פקודות ואז שינוי צבע כמו שזה אמור לעשות?
הפונקציה היא :
HTML קוד:
function fd(){
$("#thisdiv").fadeTo("slow" , 0.25);
$("#thisdiv").animate({height:10},"slow");
$("#thisdiv").hide("slow");
$('#thisdiv').css("background-color", "yellow");
$("#thisdiv").show("slow");
$("#thisdiv").animate({height:300},"slow");
$("#thisdiv").fadeTo("slow" , 1);
}
והדף המלא הוא :
HTML קוד:
<html>
<head>
<script src="http://code.jquery.com/jquery-1.4.4.js"></script>
<script type="text/javascript">
function fd(){
$("#thisdiv").fadeTo("slow" , 0.25);
$("#thisdiv").animate({height:10},"slow");
$("#thisdiv").hide("slow");
$('#thisdiv').css("background-color", "yellow");
$("#thisdiv").show("slow");
$("#thisdiv").animate({height:300},"slow");
$("#thisdiv").fadeTo("slow" , 1);
}
</script>
<style type="text/css">
.tdiv{
height: 300px;
width:300px;
background-color:blue;
}
</style>
</head>
<body>
<div id="thisdiv" class="tdiv"></div>
<button onclick="fd()">to hide</button>
</body>
</html>
אז מהיא הבעיה?
תודה.