forked from beezee/djax
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.js
31 lines (24 loc) · 808 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
jQuery('document').ready(function($) {
var transition = function($newEl) {
var $oldEl = this; // reference to the DOM element that is about to be replaced
// ** Simple fadeout/fadein **
// $newEl.hide(); // hide the new content before it comes in
// $oldEl.fadeOut("slow", function() {
// $oldEl.replaceWith($newEl);
// $newEl.show();
// $newEl.fadeIn("fast");
// });
// ** Fadeout then slide in **
$oldEl.fadeOut('fast', function () {
$oldEl.after($newEl);
$newEl.hide();
$newEl.slideDown('slow');
$newEl.fadeIn('slow');
$oldEl.remove(); // removes 'oldEl'
});
}
$('body').djax('.one-third', [], transition);
$(window).bind('djaxLoad', function(e, params) {
console.log($('<div>'+params.response+'</div>'));
})
});