DOM Ready
1
Code Link 1 Quellcode Dokumentation:
$(document).ready(function(){
// Code
});
DOM Basics
1
Code Link 1 Quellcode Dokumentation:
$("#id, .class, div").css("background", "blue");
DOM Filtering
1 2 3
Code Link 1 Quellcode Dokumentation:
$("div p").css("background", "blue");
$("div[rel='test']").css("background", "blue");
$("div p:nth-child(odd)").css("background", "blue");
DOM Manipulation
1 2 3
Code Link 1 Link 2 Link 3 Quellcode Dokumentation:
$("#id1").append("<p>Zusätzlicher Inhalt</p>");
$("#id2").replaceWith("<p>Neuer Inhalt</p>");
$("#id3").remove();
Effekte
1 2 3
Code Link 1 Link 2 Link 3 Quellcode Dokumentation:
$("#id1").slideUp("slow");
$("#id2").fadeOut(1000);
$("#id3").animate({ opacity: 0.5, height: 20 }, 1500);
Transitions
1
Code Z Link 1 Zusatz Quellcode Dokumentation:
$("#id").animate(
{ height: 20 },
1500,
"easeOutBounce"
);
Events
1
Code Link 1 Quellcode Dokumentation:
$("#id")
.click(function(){
$(this).css({ background: "red" });
})
.mouseout(function(){
$(this).css({ background: "blue" });
});
Eigene Funktionen
1
Code Link 1 Quellcode Dokumentation:
jQuery.fn.eigeneFunktion = function(parameter){
this.css({
"background": parameter.farbe,
"border": parameter.rand
});
};

$("#id").eigeneFunktion({
farbe: "red",
rand: "3px blue solid"
});
Ajax
1

2
Code Link 1 Link 2 Quellcode Dokumentation:
$("#id").load("ajax.html");

// Erweitert
$.ajax({
url: "ajax.html",
type: "GET",
success: function(req){
$("#id").html(req);
}
});
Klassen
1
Code Z Link 1 Zusatz Quellcode Dokumentation:
var Entwickler = $.inherit({
__constructor : function(name){
this.name = name;
this.firma = "Neue Firma";
},

aufgabe: function(){
return "Entwicklung";
},

info: function(){
alert(this.name + ", " + this.aufgabe() + ", " + this.firma);
}
});

var Designer = $.inherit(Entwickler, {
aufgabe: function(){
return "Design";
}
});

var neuerEntwickler = new Entwickler("Tim");
var neuerDesigner = new Designer("Tom");

neuerEntwickler.info(); // Ausgabe: "Tim, Entwicklung, Neue Firma"
neuerDesigner.info(); // Ausgabe: "Tom, Design, Neue Firma"

 Matthias Schütz - Mediendesigner / Webdesigner / Grafiker / Freelancer