Change the font weight and color of paragraphs on mouseenter and mouseleave using jquery

  • جي كويري

Change the font weight and color of paragraphs on mouseenter and mouseleave using jquery

الأجوبة

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>Change the font weight and color of paragraphs on mouseenter and mouseleave.</title>
</head>
<body>
<p>Move the mouse over this and next pragraphs.</p>
<p>Web development tutorials</p>
</body>
</html>

JavaScript Code:

$( "p" )
.on( "mouseenter", function() {
$( this ).css({
"background-color": "red",
"font-weight": "bolder"
});
})
.on( "mouseleave", function() {
var styles = {
backgroundColor : "#ded",
fontWeight: ""
};
$( this ).css( styles );
});
هل كان المحتوى مفيد؟

معلومات ذات صلة

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...