Jskieś 5 miesięcy temu strałem się o przyjęcie do pracy i teraz treśc tego zadania brzmiała tak.
Stwórz stronę HTML, na której znajduje się 5 elementów <DIV>, każdy o rozmiarze 600x10px. Po najechaniu myszką na każdy z DIV rozwija się on płynnie do rozmiaru 600x200px. Po kliku pozostaje w rozmiarze pełnym, po zjechaniu z DIV bez kliknięcia, wraca on do małych wymiarów. Ponowne kliknięcie na zablokowany wcześniej DIV (600x200px), powinno przywracać jego oryginalne zachowanie, czyli automatyczne powracanie do wymiarów 600x10px po opuszczeniu jego obszaru przez kursor. Użyj jQuery/CSS.
Tutaj daje kod.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
<head>
<title>Test PHP - Zadanie 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="../res/style.css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
<div class="wrap">
<?php
$taskNum = 3;
include __DIR__ . '/../res/nav.php';
include __DIR__ . '/../res/tasks/'.$taskNum.'.php';
?>
</div>
<div class="solution">
<?php
/** Obszar roboczy - miejsce na implementację rozwiązania zadania
************************************************************************
* BEGIN >>
************************************************************************/
print ("
<div id=div1 style=\"width:600px; height:10px; background-color:blue;\"></div>
<br>
<div id=div2 style=\"width:600px; height:10px; background-color:blue;\"></div>
<br>
<div id= div3 style=\"width:600px; height:10px; background-color:blue;\"></div>
<br>
<div id= div4 style=\"width:600px; height:10px; background-color:blue;\"></div>
<br>
<div id= div5 style=\"width:600px; height:10px; background-color:blue;\"></div>
<script language=\"javascript\">
var stan = true;
$(\"#div1\").mouseover(function(){
if (stan == true) {
$(\"#div1\").animate({height: '200px'});
}
});
$(\"#div1\").mouseout(function(){
if (stan == true) {
$(\"#div1\").animate({height: '10px'});
}
});
$(\"#div1\").click(function(){
if (stan == true) {
$(\"#div1\").animate({height: '200px'});
stan = false;
}
else if (stan == false) {
$(\"#div1\").animate({height: '10px'});
stan = true;
}
});
var stan2 = true;
$(\"#div2\").mouseover(function(){
if (stan2 == true) {
$(\"#div2\").animate({height: '200px'});
}
});
$(\"#div2\").mouseout(function(){
if (stan2 == true) {
$(\"#div2\").animate({height: '10px'});
}
});
$(\"#div2\").click(function(){
if (stan2 == true) {
$(\"#div2\").animate({height: '200px'});
stan2 = false;
}
else if (stan2 == false) {
$(\"#div2\").animate({height: '10px'});
stan2 = true;
}
});
var stan3 = true;
$(\"#div3\").mouseover(function(){
if (stan3 == true) {
$(\"#div3\").animate({height: '200px'});
}
});
$(\"#div3\").mouseout(function(){
if (stan3 == true) {
$(\"#div3\").animate({height: '10px'});
}
});
$(\"#div3\").click(function(){
if (stan3 == true) {
$(\"#div3\").animate({height: '200px'});
stan3 = false;
}
else if (stan3 == false) {
$(\"#div3\").animate({height: '10px'});
stan3 = true;
}
});
var stan4 = true;
$(\"#div4\").mouseover(function(){
if (stan4 == true) {
$(\"#div4\").animate({height: '200px'});
}
});
$(\"#div4\").mouseout(function(){
if (stan4 == true) {
$(\"#div4\").animate({height: '10px'});
}
});
$(\"#div4\").click(function(){
if (stan4 == true) {
$(\"#div4\").animate({height: '200px'});
stan4 = false;
}
else if (stan4 == false) {
$(\"#div4\").animate({height: '10px'});
stan4 = true;
}
});
var stan5 = true;
$(\"#div5\").mouseover(function(){
if (stan5 == true) {
$(\"#div5\").animate({height: '200px'});
}
});
$(\"#div5\").mouseout(function(){
if (stan5 == true) {
$(\"#div5\").animate({height: '10px'});
}
});
$(\"#div5\").click(function(){
if (stan5 == true) {
$(\"#div5\").animate({height: '200px'});
stan5 = false;
}
else if (stan5 == false) {
$(\"#div5\").animate({height: '10px'});
stan5 = true;
}
});
</script>
");
/************************************************************************
* << END
************************************************************************/
?>
</div>
<?php include __DIR__ . '/../res/footer.php'; ?>
</body>
</html>
abrakadaber