Increase the size of a division when you click it using jquery
- جي كويري
- 2021-09-18
- mhanasmh00489829403
الأجوبة
HTML Code :
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Increase the size of a div when you click it.</title>
</head>
<body>
<div class="div1">Click to increase the size</div>
<div class="div2">Click to increase the size</div>
</body>
</html>
CSS Code :
.div1 {
width: 100px;
height: 60px;
background-color: #f33;
color: white
}
.div2 {
width: 100px;
height: 60px;
background-color: #a14;
color: white
}
JavaScript Code :
$( "div" ).on( "click", function(){
$( this ).css({
width: function( index, value ) {
return parseFloat( value ) * 1.2;
},
height: function( index, value ) {
return parseFloat( value ) * 1.2;
}
});
});
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
معلومات ذات صلة