
jQuery CSS
سوف تتعلم في هذا الدرس التحكم في ال CSS Properties وايضاً التحكم في اضافة وتغيير ال CSS Classes باستخدام ال jQuery
التاريخ
30 نوفمبر 2021
الدروس
22
المستوى
العامة
اللغة
انجليزي
المشاهدات
458
المواضيع
4
jQuery CSS
</> Get CSS Property Value
ال css() method تتحكم في خصائص ال CSS التي تعرف بال CSS Properties لأي HTML Element
للحصول علي ال Value الخاصة باي Property نقوم بكتابة اسم ال Property بداخل ال css() method
css("propertyname");
$("p").css("color");
</> jQuery Set CSS Property
ال css() method تتحكم في خصائص ال CSS التي تعرف بال CSS Properties لأي HTML Element
للتعديل علي ال Value الخاصة باي Property او اضافة Property جديدة نقوم بكتابة اسم ال Property بداخل ال css() method متبوعاً بال Value
$("p").css("color", "orange");
$(document).ready(function(){ $("button").click(function(){ $("p").css("color", "orange"); }); });
</> Set Multiple CSS Properties
للتعديل علي اكثر من Value او ضافاة اكتر من Property بداخل ال css() method تكتب بالطريقة التالية
css({"propertyname":"value","propertyname":"value",...});
$("p").css({"color": "orange", "font-size": "25px"});
</> jQuery addClass
ال jQuery addClass() Method تستخدم في اضافة Value ل class Attribute للتاثير علي ال Elements
$("#button").click(function(){ $("h1, h2, p").addClass("blue"); $("#div").addClass("important"); });
<!DOCTYPE html> <html> <body> <h1 id="myHeading">How to change the style of a heading</h1> <script> document.getElementById("myHeading").style.color = "red"; </script> </body> </html>
</> jQuery removeClass
ال jQuery removeClass() Method تستخدم في ازالة Value ل class Attribute لازالة التاثير من ال Elements
$("#button").click(function(){ $("h1, h2, p").removeClass("blue"); });
</> jQuery toggleClass
ال jQuery toggleClass() Method تستخدم في التبديل بين اضافة\ازالة Value ل class Attribute لاي Element
$("button").click(function(){ $("p").toggleClass("main"); });