JavaScript - Page Transitions: Unterschied zwischen den Versionen
Aus Wikizone
| Zeile 3: | Zeile 3: | ||
* http://designdrizzle.com/15-amazing-page-transitions-effects-tutorials-in-jquery-and-css3/ | * http://designdrizzle.com/15-amazing-page-transitions-effects-tutorials-in-jquery-and-css3/ | ||
* https://webdesign.tutsplus.com/tutorials/how-to-create-an-ajax-driven-theme-for-processwire--cms-26579 | * https://webdesign.tutsplus.com/tutorials/how-to-create-an-ajax-driven-theme-for-processwire--cms-26579 | ||
| − | https://tympanus.net/Development/FullscreenLayoutPageTransitions/ | + | * https://tympanus.net/Development/FullscreenLayoutPageTransitions/ |
== Tutorials == | == Tutorials == | ||
Version vom 1. März 2017, 11:59 Uhr
Tools und Links
- http://git.blivesta.com/animsition/
- http://designdrizzle.com/15-amazing-page-transitions-effects-tutorials-in-jquery-and-css3/
- https://webdesign.tutsplus.com/tutorials/how-to-create-an-ajax-driven-theme-for-processwire--cms-26579
- https://tympanus.net/Development/FullscreenLayoutPageTransitions/
Tutorials
Quickstart
AJAX Strategie
- 2 verschachtelte Container
- Der äußere beinhaltet alle Inhalte. An den inneren werden die neuen Inhalte angehängt (append)
- Page Transition wird ausgeführt und der innere Container mit den alten Inhalten ausgeblendet.
- Evtl. Browser History aktualisieren und URL
- Evtl. Seitenskripte neu initialisieren
Inhalte dynamisch nachladen mit AJAX
Seitenrequest auslösen
jQuery
$(function() {
var href;
var title;
$('body').on('click','a.ajax-link',function(e) { // nav link clicked
href = $(this).attr("href");
title = $(this).attr("name");
// load content via AJAX
loadContent(href);
// prevent click and reload
e.preventDefault();
});
function loadContent(url){ // Load content
// variable for page data
$pageData = '';
// send Ajax request
$.ajax({
type: "POST",
url: url,
data: { ajax: true },
success: function(data,status){
$pageData = data;
}
}).done(function(){ // when finished and successful
// construct new content
$pageData = '<div class="content no-opacity ajax">' + $pageData + '</div>';
// add content to page
$('.content-container').append($pageData);
// remove old content
$('.content.current-content').remove();
// show new content and clean up classes
$(this).removeClass('no-opacity').removeClass('ajax').addClass('current-content');
}); // end of ajax().done()
} // end of loadContent()
});