Benutzer-Werkzeuge

Webseiten-Werkzeuge


jquery:start

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
jquery:start [2015-03-15 22:56] – Erweitert a.kamolajquery:start [2015-08-14 20:36] (aktuell) – [Snippets] "Smooth-Scrolling" eingefügt a.kamola
Zeile 134: Zeile 134:
 ); );
 </code> </code>
 +
 +==== Smooth-Scrolling ====
 +
 +<code javascript>
 +$('a[href^="#"]').on('click', function(e) {
 + // Prevent default anchor click behavior
 + e.preventDefault();
 +
 + // Store hash
 + var hash = this.hash;
 +
 + // Animate
 + $('html, body').animate({
 + scrollTop: $(hash).offset().top
 + }, 300, function(){
 + // when done, add hash to url (default click behaviour)
 + window.location.hash = hash;
 + });
 +});
 +</code>
 +
 +Quelle: [[http://stackoverflow.com/a/14805098|Stack Overflow: How to add smooth scrolling to Bootstrap's scroll spy function?]]
 +
 +===== Cookies =====
 +
 +  * [[https://github.com/carhartl/jquery-cookie/|jQuery Cookie Plugin]]
  
 ===== Links ===== ===== Links =====
jquery/start.1426456568.txt.gz · Zuletzt geändert: 2015-03-15 22:56 von a.kamola