Design and Jekyll added

This commit is contained in:
Timm Szigat 2014-10-26 14:11:10 +01:00
parent 4ecb1e7cae
commit b4415b675e
75 changed files with 465 additions and 7596 deletions

View File

@ -1,7 +1,9 @@
# Site settings
title: chaospott
title: chaospott - your gate to /dev/null
email: info@chaospott.de
description: Blog des CCC Essen Chaospott
description: >
Wir sind der örtliche Erfa-Kreis des Chaos Computer Clubs in Essen. Unsere Gesprächsthemen und Projekte reichen von Soft- und Hardware zu Datenschutz und Netzpolitik.
Alle Interessierten sind herzlich zu unserem Treff eingeladen.
baseurl: ""
url: "http://chaospott.de"
twitter_username: foobarev

View File

@ -1,55 +1,36 @@
<footer class="site-footer">
<div class="wrapper">
<h2 class="footer-heading">{{ site.title }}</h2>
<div class="footer-col-wrapper">
<div class="footer-col footer-col-1">
<ul class="contact-list">
<li>{{ site.title }}</li>
<li><a href="mailto:{{ site.email }}">{{ site.email }}</a></li>
</ul>
</div>
<div class="footer-col footer-col-2">
<ul class="social-media-list">
{% if site.github_username %}
<li>
<a href="https://github.com/{{ site.github_username }}">
<span class="icon icon--github">
<svg viewBox="0 0 16 16">
<path fill="#828282" d="M7.999,0.431c-4.285,0-7.76,3.474-7.76,7.761 c0,3.428,2.223,6.337,5.307,7.363c0.388,0.071,0.53-0.168,0.53-0.374c0-0.184-0.007-0.672-0.01-1.32 c-2.159,0.469-2.614-1.04-2.614-1.04c-0.353-0.896-0.862-1.135-0.862-1.135c-0.705-0.481,0.053-0.472,0.053-0.472 c0.779,0.055,1.189,0.8,1.189,0.8c0.692,1.186,1.816,0.843,2.258,0.645c0.071-0.502,0.271-0.843,0.493-1.037 C4.86,11.425,3.049,10.76,3.049,7.786c0-0.847,0.302-1.54,0.799-2.082C3.768,5.507,3.501,4.718,3.924,3.65 c0,0,0.652-0.209,2.134,0.796C6.677,4.273,7.34,4.187,8,4.184c0.659,0.003,1.323,0.089,1.943,0.261 c1.482-1.004,2.132-0.796,2.132-0.796c0.423,1.068,0.157,1.857,0.077,2.054c0.497,0.542,0.798,1.235,0.798,2.082 c0,2.981-1.814,3.637-3.543,3.829c0.279,0.24,0.527,0.713,0.527,1.437c0,1.037-0.01,1.874-0.01,2.129 c0,0.208,0.14,0.449,0.534,0.373c3.081-1.028,5.302-3.935,5.302-7.362C15.76,3.906,12.285,0.431,7.999,0.431z"/>
</svg>
</span>
<span class="username">{{ site.github_username }}</span>
</a>
</li>
{% endif %}
{% if site.twitter_username %}
<li>
<a href="https://twitter.com/{{ site.twitter_username }}">
<span class="icon icon--twitter">
<svg viewBox="0 0 16 16">
<path fill="#828282" d="M15.969,3.058c-0.586,0.26-1.217,0.436-1.878,0.515c0.675-0.405,1.194-1.045,1.438-1.809
c-0.632,0.375-1.332,0.647-2.076,0.793c-0.596-0.636-1.446-1.033-2.387-1.033c-1.806,0-3.27,1.464-3.27,3.27 c0,0.256,0.029,0.506,0.085,0.745C5.163,5.404,2.753,4.102,1.14,2.124C0.859,2.607,0.698,3.168,0.698,3.767 c0,1.134,0.577,2.135,1.455,2.722C1.616,6.472,1.112,6.325,0.671,6.08c0,0.014,0,0.027,0,0.041c0,1.584,1.127,2.906,2.623,3.206 C3.02,9.402,2.731,9.442,2.433,9.442c-0.211,0-0.416-0.021-0.615-0.059c0.416,1.299,1.624,2.245,3.055,2.271 c-1.119,0.877-2.529,1.4-4.061,1.4c-0.264,0-0.524-0.015-0.78-0.046c1.447,0.928,3.166,1.469,5.013,1.469 c6.015,0,9.304-4.983,9.304-9.304c0-0.142-0.003-0.283-0.009-0.423C14.976,4.29,15.531,3.714,15.969,3.058z"/>
</svg>
</span>
<span class="username">{{ site.twitter_username }}</span>
</a>
</li>
{% endif %}
</ul>
</div>
<div class="footer-col footer-col-3">
<p class="text">{{ site.description }}</p>
</div>
<hr>
<div class="container" id="contact">
<div class="row">
<div class="col-md-6">
<p>
<span class="fa fa-map-marker"></span> <a href="http://nominatim.openstreetmap.org/search.php?q=foobar%2C+essen&amp;viewbox=7.02%2C51.44%2C7.03%2C51.43">Sibyllastr. 9 (Hinterhof), 45136 Essen</a>
</p>
<p>
<span class="fa fa-phone"></span> <a href="tel:+4912351235544">+49 (0) 1234 / 567 89 0</a>
</p>
<p>
<span class="fa fa-envelope-o"></span> <span id="e701819447">[javascript protected email address]</span><script type="text/javascript">/*<![CDATA[*/eval("var a=\".Pc3y1Lh6oqgCSMluXaN-F0mWOK_ewAvVBdZstj2rpTf85+@iRznY4xI7QJUGkHD9Eb\";var b=a.split(\"\").sort().join(\"\");var c=\"fJE7GI7pJGESfffP5UU5xc85\";var d=\"\";for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));document.getElementById(\"e701819447\").innerHTML=\"<a href=\\\"mailto:\"+d+\"\\\">\"+d+\"</a>\"")/*]]>*/</script>
<br>
<span class="fa fa-lock"></span> <a href="media/ccc-essen.pgp">01CB 5D67 4100 6A17 2492 739D 4592 4F8A 867E D719</a>
</p>
</div>
<div class="col-md-6">
<p>
<i class="fa fa-twitter"></i> <a href="https://twitter.com/foobarev">@foobarev</a>
</p>
<p>
<span class="fa fa-inbox"></span> <a href="https://lists.cccmz.de/mailman/listinfo/chaostreff-essen"><span id="e699026149">[javascript protected email address]</span><script type="text/javascript">/*<![CDATA[*/eval("var a=\"fnF9IG32pj+g0bLHEk6w-Y_Z4NzqaSTWCeVMxXBoudQJ8cKhO@1sD5t.ilrAPvUyR7m\";var b=a.split(\"\").sort().join(\"\");var c=\"JOd.APrcKKncAActnAvQAJr@QcbD@APAFJJJ5mF8c\";var d=\"\";for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));document.getElementById(\"e699026149\").innerHTML=d")/*]]>*/</script></a>
<br>
<span class="fa fa-comments"></span>
<a href="http://hackint.eu">hackint.eu</a>
( <a href="irc://hackint.eu/chaospott">#chaospott</a> )
</p>
<p>
<i class="fa fa-github"></i> <a href="https://github.com/c3e">c3e</a>
</p>
</div>
</div>
</div>
</footer>

View File

@ -1,11 +1,18 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>
<meta name="description" content="{{ site.description }}">
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<meta charset="utf-8" />
<title>
{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}
</title>
<meta name="description" content="{{ site.description }}">
<meta name="viewport" content="width=device-width initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">
<link rel="canonical" href="{{ page.url | replace:'index.html','' | prepend: site.baseurl | prepend: site.url }}">
<script src="{{ "/bootstrap/js/jquery-2.1.1.min.js" | prepend: site.baseurl }}" type="text/javascript"></script>
<script src="{{ "/bootstrap/js/bootstrap.js" | prepend: site.baseurl }}" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="{{ "/bootstrap/css/bootstrap.css" | prepend: site.baseurl }}">
<!--<link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-theme.css">-->
<link rel="stylesheet" type="text/css" href="{{ "/css/style.css" | prepend: site.baseurl }}">
<link href="http://fonts.googleapis.com/css?family=Share+Tech" rel="stylesheet" type="text/css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
</head>

View File

@ -1,27 +1,13 @@
<header class="site-header">
<div class="wrapper">
<a class="site-title" href="{{ site.baseurl }}/">{{ site.title }}</a>
<nav class="site-nav">
<a href="#" class="menu-icon">
<svg viewBox="0 0 18 15">
<path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/>
<path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/>
<path fill="#424242" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/>
</svg>
</a>
<div class="trigger">
{% for page in site.pages %}
{% if page.title %}
<a class="page-link" href="{{ page.url | prepend: site.baseurl }}">{{ page.title }}</a>
{% endif %}
{% endfor %}
</div>
</nav>
<nav class="navbar navbar-fixed-top" role="navigation">
<hr style="margin:0; border-color:green; border-width:4px 0px;">
<div class="container">
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/">Home</a></li>
<li><a href="/blog.html">Logbuch</a></li>
<li><a href="/#about">&Uuml;ber uns</a></li>
<li><a href="#contact">Kontakt</a></li>
</ul>
</div>
</div>
</header>
</nav>

View File

@ -1,20 +1,24 @@
<!DOCTYPE html>
<html>
{% include head.html %}
<body>
{% include header.html %}
<div class="page-content">
<div class="wrapper">
{{ content }}
</div>
<div class="jumbotron">
<div class="container-fluid large-header" id="large-header">
<canvas id="demo-canvas" style="position:absolute;"></canvas>
<div class="row row-centered">
<div class="col-centered">
<img src="{{ "/images/logo.png" | prepend: site.baseurl }}" alt="Chaospott Logo" />
</div>
</div>
</div>
<hr>
{{ content }}
{% include footer.html %}
</div>
{% include footer.html %}
<script src="{{ "/js/TweenLite.min.js" | prepend: site.baseurl }}"></script>
<script src="{{ "/js/EasePack.min.js" | prepend: site.baseurl }}"></script>
<script src="{{ "/js/rAF.js" | prepend: site.baseurl }}"></script>
<script src="{{ "/js/eyecandy.js" | prepend: site.baseurl }}"></script>
</body>
</html>

View File

@ -1,15 +1,20 @@
---
layout: default
---
<div class="post">
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
<p class="post-meta">{{ page.date | date: "%b %-d, %Y" }}{% if page.author %} • {{ page.author }}{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
</header>
<div class="container">
<div class="row">
<div class="col-md-12 post">
<article class="post-content">
{{ content }}
</article>
<header class="post-header">
<h1 class="post-title">{{ page.title }}</h1>
<p class="post-meta">{{ page.date | date: "%b %-d, %Y" }}{% if page.author %} • {{ page.author }}{% endif %}{% if page.meta %} • {{ page.meta }}{% endif %}</p>
</header>
<article class="post-content">
{{ content }}
</article>
</div>
</div>
</div>

View File

@ -0,0 +1,7 @@
---
layout: post
title: "Cryptoparty"
date: 2014-07-04 13:37:42
categories: cryptoparty
---
Am 22. Juli 2014 um 19 Uhr veranstaltet der CCC-Essen in seinen Räumlichkeiten (Sibyllastr. 9, Essen-Süd) eine Cryptoparty und läd dazu alle Interessierten ein. Da unsere Räume nur begrenzt Platz bieten, wird um eine Anmeldung per Email an cryptoparty@ccc-essen.de gebeten. Bei entsprechendem Interesse wird es auch weitere Cryptoparties geben. Weitere Informationen finden sich unter

View File

@ -0,0 +1,15 @@
---
layout: post
title: "Freifunk versorgt Nord Open Air mit Internet"
date: 2014-08-02 13:37:42
categories: freifunk
---
Alles begann mit einer Anfrage des Nord Open Air Veranstalters: “Wir brauchen auf dem Open Air Internet im Backstage. Könnt ihr da was machen?”
Klar konnten wir. Das Cafe Nord ist bereits mit einem Freifunk-Router ausgestattet und so mussten wir nur das Signal verlängern. Bei der Suche nach der passenden Antenne kam die Idee auf, nicht nur die Bands im Backstage, sondern direkt alle Besucher mit Internetz zu versorgen. Gesagt getan. 8 Router wurden mit aktueller Firmware bespielt und in Bierwagen, auf der Bühne und im angrenzenden Cafe aufgestellt und mit Strom versorgt. Gespannt beobachteten wir den Netzwerkgraphen, um zu sehen, ob das Mesh-Netz auch funktionierte. W00t!
An den Festivaltagen waren keine grossen Ausfälle zu verzeichnen. Auch wenn einzelne Router versehentlich abgestöpselt wurden, übernahmen die anderen die Weiterleitung der Datenpakete. An einem Router wurden über 40 Clients beobachtet. Das Angebot nutzten bis zu 150 Benutzer gleichzeitig. Ein voller Erfolg.
Ich möchte gerne Timm und gammlaa fürs Knowhow, Cafe Babel für Upstream und Cafe Nord für die Unterstützung danken.
Julian

View File

@ -0,0 +1,15 @@
---
layout: post
title: "BBQ 2014 - 10+1 Jahre Chaostreff Dortmund"
date: 2014-08-14 13:37:42
categories: essen auf rädern
---
Der Chaostreff Dortmund lud am 07.06.14 zum BBQ, um das 10+1-jährige Jubiläum zu feiern. Eine gute Gelegenheit, um die erweiterten Räumlichkeiten im Langen August zu besuchen. Der “Langer August” ist ein selbstverwaltendes Initiativenhaus, in dem der CTDo seit 2005 beheimatet ist. Die Clubräume befinden sich in der zweiten Etage und sind mit einer großen Elektronikwerkstatt und zwei weiteren Räumen deutlich größer geworden. Die Elektronikwerkstatt bietet viel Platz und eine gute Ausstattung zum Basteln. Ein Gast sagte, dass sein Kind Erfinder werden möchte und sie/er deshalb zum BBQ gekommen sei, um sich den Hackerspace anzuschauen. Bei der Ausstattung sollte das Erfinden kein Problem sein. In den hinteren Räumen wurden Schneidplotter, Lasercutter, Drehbank, CNC-Fräse und Lagerfläche gesichtet. Der Seminarraum im ausgebauten Dachboden steht allen Initiativen des Hauses zur Verfügung und wird vom CTDo für Vorträge genutzt. Insgesamt ein großartiger Rahmen, um das 10+1-jährige Bestehen zu feiern.
Bei kühlen Getränken und gestärkt durch ein großes Buffet in der Küche, wurden viele bekannte Gesichter und Gäste gesichtet. In der Elektronikwerkstatt wurde sich ausgiebig über 3D-Druck ausgetauscht und nach Lösungen für bessere Druckergebnisse gesucht. Neben den häufig anzutreffenden Druckern, sei es RepRap oder Makerbot, gingen mehrere “Delta-Drucker” ihrer Arbeit nach und druckten Testfiguren oder Verbindungselemente für weitere Drucker. Den Rahmen bilden Fischer Technik-Profile, die mit ausgedruckten Eckstücken verbunden sind. Beeindruckend ist die Druckqualität dieser Geräte, die von kommerziellen Produkten nicht zu unterscheiden ist.
An einer anderen Tischecke wurden einige Flipdot-Panele gesichtet, die ihren Weg von muCCC nach Dortmund gefunden hatten. Nachdem die Treiberplatine zusammengelötet war, wurde mit der Hilfe der Dokumentation das passende Image und die richtigen Treiber für den Raspi gesucht. Zu später Stunde erfüllte ein Testprogramm die Clubräume mit dem bekannten Klackern der Anzeigen. Bei der Geräuschkulisse schlugen die Herzen einiger Hacker etwas schneller.
In der Sofaecke wurde sich über Neuigkeiten aus dem Clubumfeld ausgetauscht. Ewige Diskussionen auf der Mailingliste, Platzmangel und Gäste, die das Darknet suchen, sind auch beim CTDo bekannt. Neben Anekdoten und Geschichten aus Zeiten, in denen die Bandbreite zum Datentransfernetz nur wenige kByte betrug, wurden noch Tipps für den Bau eines Hexacopter, Spaceinvaders aus Holz und Stempel für den Hackerpass eingesammelt.
Vielen Dank für netten Abend.

View File

@ -0,0 +1,9 @@
---
layout: post
title: "Chaospot 2.0"
date: 2014-10-17 12:58:29
categories: space update
---
Zusätzlich zu den Kellerräumen ist seit dem 1. Juni 2014 ein Büro in der ersten Etage angemietet. Die angestiegende Anzahl der aktiven Entitäten und das gewachsene Interesse an der Vortragsreihe “Petitfoo” sorgten vor allem während des Chaostreffs für Platzmangel und stickige Luft.
Da sich der Chaospott im Hofgebäude der Sibyllastraße 9 wohl fühlt, kam das Angebot für das Büro im 1.OG sehr gelegen. Auf den ca. 130 qm hat sich in den letzten Monaten vieles getan. Die Sofalandschaft ist zusammen mit der Bespaßungtechnik für Auge und Ohr in das OG umgezogen. Der freigewordene Raum im Keller wurde gestrichen und dank einer Spende haben drei Laborschränke den Weg in selbigen gefunden. Das Netzwerk hat auch das Level 2.0 erreicht, dazu wurde ein Rack für Server und Router sowie leistungsstarke Access Points angeschafft und teilweise mit Lichtwellenleitern verbunden. Damit man auch die zweite Tür elektronisch öffnen und schließen kann, wird an einer Erweiterung der foodoor gebastelt. Ein RaspberryPi steuert über die Erweiterungsplatine “PiFaceDigital” diverse Taster, den Summer und die Schließelektronik an. Nach einer lustigen Diskussion auf diversen Kanälen wurde der kleinste Raum Bällebad getauft, welches in naher Zukunft neben der Bibliothek auch einen 3D-Drucker beherbergen wird. Da Bilder mehr als 1216 Zeichen (ohne Leerzeichen inklu. Überschrift) sagen, gibt es an dieser Stelle ein paar Bilder.

View File

@ -0,0 +1,25 @@
---
layout: post
title: "Welcome to Jekyll!"
date: 1970-01-01 12:58:29
categories: jekyll update
---
Youll find this post in your `_posts` directory. Go ahead and edit it and re-build the site to see your changes. You can rebuild the site in many different ways, but the most common way is to run `jekyll serve --watch`, which launches a web server and auto-regenerates your site when a file is updated.
To add new posts, simply add a file in the `_posts` directory that follows the convention `YYYY-MM-DD-name-of-post.ext` and includes the necessary front matter. Take a look at the source for this post to get an idea about how it works.
Jekyll also offers powerful support for code snippets:
{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}
Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekylls GitHub repo][jekyll-gh]. If you have questions, you can ask them on [Jekylls dedicated Help repository][jekyll-help].
[jekyll]: http://jekyllrb.com
[jekyll-gh]: https://github.com/jekyll/jekyll
[jekyll-help]: https://github.com/jekyll/jekyll-help

View File

@ -2,7 +2,7 @@
* Reset some basic elements
*/
body, h1, h2, h3, h4, h5, h6,
p, blockquote, pre, hr,
p, blockquote, pre,
dl, dd, ol, ul, figure {
margin: 0;
padding: 0;

23
blog.html Normal file
View File

@ -0,0 +1,23 @@
---
layout: default
---
{% for post in site.posts %}
{% if forloop.first == false %}
<hr>
{% endif %}
<div class="container" id="posts">
<div class="row">
<div class="col-md-12">
<h2>{{ post.title }}</h2>
<p>
{{ post.content | truncatewords:200 }}
</p>
{% assign wordcount = post.content | number_of_words %}
{% if wordcount > 200 %}
<p><a class="btn btn-default" href="{{ post.url | prepend: site.baseurl }}" role="button">&gt; Weiterlesen</a></p>
{% endif %}
</div>
</div>
</div>
{% endfor %}

96
css/style.css Normal file
View File

@ -0,0 +1,96 @@
* {
background-color:transparent;
font-family: 'Share Tech', sans-serif;
}
#large-header {
padding:0;
margin:0;
}
body, .jumbotron {
background-color:#d2d4bc;
}
.jumbotron h1 {
font-size:26px;
font-weight:bold;
margin-top:50px;
}
.navbar {
/* background-color:#350505; */
background-color:#d2d4bc;
border:none;
opacity: 0.9;
}
ul.navbar-nav li {
border-right:1px red solid;
}
ul.navbar-nav li:last-child {
border-right:0;
}
ul.navbar-nav li a {
color:red !important;
}
.btn-default {
border:0;
background-color:transparent;
color:red;
}
a {
color:red;
}
a:visited {
color:#800032;
}
.row {
padding:50px 0px;
}
.jumbotron {
margin:0;
padding:0;
}
#large-header {
background-color:#222;
height:500px;
margin-bottom:160px;
}
#large-header img {
position:relative;
top:75px;
}
.row-centered {
text-align:center;
}
.col-centered {
display:inline-block;
float:none;
/* reset the text-align */
text-align:left;
/* inline-block space fix */
margin-right:-4px;
}
ul.nav>li>a {
color:red;
}
.jumbotron>hr {
background-color:black;
height:1px;
border: 3px #333 solid;
width:300px;
}

View File

@ -1 +0,0 @@
node_modules/

View File

@ -1,3 +0,0 @@
language: node_js
node_js:
- 0.10

View File

@ -1,15 +0,0 @@
Questions belong to StackOverflow
=====
GitHub is for issues and feature requests. Anything else belongs to [StackOverflow](http://stackoverflow.com/questions/ask?tags=skrollr).
Pull requests
=====
Will be ignored if the Travis build fails. Install grunt and run `grunt jshint qunit` locally before submitting pull requests.
Do not include build files in your pull request (e.g. `skrollr.min.js`).
Do not change the version number in your pull request.
Do not try to fix multiple issues or add multiple features with a single pull request. A pull request should only do one thing.

View File

@ -1,51 +0,0 @@
module.exports = function(grunt) {
//Configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json') ,
jshint: {
options: {
smarttabs: false,
curly: true,
immed: true,
latedef: true,
noarg: true,
quotmark: 'single',
undef: true,
unused: true,
strict: true,
trailing: true,
globals: {
window: true,
document: true,
navigator: true,
define: true,
module: true
}
},
all: ['src/**/*.js']
},
qunit: {
all: ['test/index.html', 'test/loading.html']
},
uglify: {
options: {
banner: '/*! skrollr <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>) | Alexander Prinzhorn - https://github.com/Prinzhorn/skrollr | Free to use under terms of MIT license */\n'
},
all: {
files: {
'dist/skrollr.min.js': 'src/skrollr.js'
}
}
}
});
//Dependencies.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-contrib-uglify');
//Tasks.
grunt.registerTask('default', ['jshint', 'qunit', 'uglify']);
grunt.registerTask('travis', ['jshint', 'qunit']);
};

View File

@ -1,313 +0,0 @@
0.6.26 (2014-06-08)
-------------------
* Fixed easing functions not working when animating attributes (#533)
0.6.25 (2014-05-22)
-------------------
* CommonJS (#519).
0.6.24 (2014-04-25)
-------------------
* Fixed some issue with forceHeight (#347).
* Fixed a regression caused by #486 breaking IE 8 (#494).
* Added support for animating attributes (#204).
0.6.23 (2014-04-18)
-------------------
**note**: This particular version is broken in IE!
* Experimental support for emitting events when the scrolling passes a keyframe (check out the docs for `keyframe` option/event).
* When using `refresh`, make sure elements which do not longer have keyframes get properly cleaned up (#486).
* Fixed `refresh` not accepting `NodeList`s (#435).
* Expose the status of mobile mode as `isMobile()` function (#488).
0.6.22 (2014-02-21)
-------------------
* Experimental AMD support (#409). Please read the documentation about it.
0.6.21 (2014-01-06)
-------------------
* Disabled mobile mode on Windows Phone, since it's not needed there (#408).
0.6.20 (2014-01-03)
-------------------
* Fixed broken percentage constants.
0.6.19 (2014-01-02)
-------------------
* Constants can now be defined as functions or percentage offsets (#148, #404).
**breaking**: When using a constant of value `100` together with percentage offsets like `data-_foo-75p`,
the value was implicitly handled as percentage value `100p`. Starting with this version you need to explcitly use `100p` if you want percentage constants.
On the plus side, you can now mix an absolute constant with a percentage keyframe or a percentage constant with an absolute keyframe.
0.6.18 (2013-12-18)
-------------------
* Fixed scrolling on input elements (#397).
0.6.17 (2013-10-19)
------
* Fixed keyboard not appearing on some mobile browsers when an input was focused (#349).
0.6.16 (2013-10-18)
------
* Fixed `z-index:auto;` not working because it was always coerced to an integer (#351).
0.6.15 (2013-10-03)
------
* Fixed clicking on links (and other elements) on mobile (#263, #303, #338).
* Added `getMaxScrollTop` method (#238).
0.6.14 (2013-10-03)
------
* Fixed the `direction` parameter that's passed to the render events (#339).
0.6.13 (2013-09-29)
-----
* Added support for percentage offsets (#185).
0.6.12 (2013-09-17)
-----
* Added `destroy` method (#109).
0.6.11 (2013-08-13)
-----
* Made the mobile deceleration configurable and lowered the default (#222, #229).
0.6.10 (2013-07-30)
-----
* Fixed bug which caused IE to perform an endless loop (#271).
0.6.9 (2013-07-01)
-----
* Improved overall performance for mobile (#249).
0.6.8 (2013-06-17)
-----
* Added a new option `smoothScrollingDuration`.
0.6.7 (2013-06-17)
-----
* Changed the default value of `edgeStrategy` from `ease` to `set`. There are too many cases where `ease` was not wanted and unexpected.
0.6.6 (2013-06-05)
-----
* Fixed IE plugin not working. This was caused by assigning `skrollr.setStyle` to a local variable inside the skrollr core. Since the IE plugin monkey-patches the skrollr.setStyle function, the core didn't notice the change (#199 comment 18986949).
0.6.5 (2013-05-22)
-----
* Fixed crash in IE < 9 because the detected prefix was `null` (#220).
0.6.4 (2013-05-21)
-----
* Fixed that some elements got the `skrollable-before` **and** `skrollable-after` class at the same time.
0.6.3 (2013-05-19)
-----
* When resizing the browser, the scroll position was reset to 0 (#217)
0.6.2 (2013-05-18)
-----
* When resizing the browser, `forceHeight` was colliding with the already forced height (#216).
0.6.1 (2013-05-18)
-----
* Allow numbers inside of easing function names (#152).
0.6.0 (2013-05-18)
-----
**Expect things to break when coming from 0.5! Read through the changelog. Migration is not hard.**
* **[breaking]** There's no more `skrollr.mobile.js` file. You only need `skrollr.js`. You no longer need to conditionally include `skrollr.mobile.js`.
* You can configure how skrollr detects mobile browsers using the `mobileCheck` option (check out the documentation).
* **[possibly breaking]** The meaning of the `#skrollr-body` element changed. Put all static elements inside of it and all absolute/fixed elements outside. It doesn't need to be the first child of the body anymore.
* **[breaking]** The `rendered` and `unrendered` classes where renamed because they were confusing and wrong. They're now called `skrollable-before` and `skrollable-after`, because that's their meaning (the element with these classes is before/after the first/last keyframe).
* Added a new class `skrollable-between`, because symmetry. That's why.
* Easing functions are now applied when exactly at a keyframe (#132).
* **[possibly breaking]** The behavior changed for the case when the scroll position is before/after the first/last keyframe (I'm just gonna use "before first" from now on, because "after last" is analog). In 0.5 the behavior was not exactly specified and buggy (see item above regarding #132). Skrollr was applying the styles of the first keyframe to the element for all scroll position that were before the first keyframe. E.g. when `data-100="top:200px;"` was the first keyframe, the element had `top:200px;` at all scroll positions before (all from `0` to `99`). From now on you can specify the behavior you want (see `edgeStrategy` option for details, set it to `set` for old behavior). **Note: 0.6.7 and up use `set` as default.**
0.5.14
-----
* Add a `skrollr-mobile` class to the html element when the mobile script is included.
0.5.13 (2013-02-08)
-----
* #131: Use a cross browser approach for getting the body scroll-height.
* #133: Use the maximum of document height or the max keyframe for edge cases where absolute keyframes are used in a relative-mode-like document and `data-end` was calculated wrong.
0.5.12 (2013-02-08)
-----
* #121: Fixed prefix detection in Safari.
0.5.11 (2013-01-18)
-----
* #126: When calling refresh(), force rerendering, even if the scrollbar didn't move.
0.5.10
-----
* #104: Fixed the most annoying bug on mobile. There was a large blank space at the bottom of the page.
0.5.9
-----
* #118: Fixed broken prefix detection. Was broken all the time, but worked before Firefox 18.
0.5.8 (2013-01-12)
-----
* #116 + #117: SVG support was broken for relative mode.
0.5.7
-----
* #103: skrollr no longer depends on being added to the bottom of the document.
0.5.6
-----
* #105: Fixed inconsistent behaviour for adding `rendered` and `unrendered` class on page load
0.5.5
-----
* #100: Fixed relative-mode not working correctly in IE < 9 due to crippled getBoundingClientRect
0.5.4 (2012-11-18)
-----
* #80: When resizing the browser window the calculation of relative mode was wrong when the element's vertical position was changed before.
0.5.3
-----
* #66: Make IE 7 support a light version of `data-anchor-target` by mapping `querySelector` to `getElementById`.
0.5.2
-----
* #78: Fixed that new parser didn't allowed omitting the last semicolon in a keyframe property list.
0.5.1 (2012-10-29)
-----
* Fixed `setScrollTop` and `animateTo` not working because iScroll uses negative offset.
0.5.0 (2012-10-09)
-----
* *breaking* the `plugin` api has been removed (the IE plugin has been updated to a new, hidden api).
* Full mobile support using iscroll.
* #73: Fixed parser to not mess up colons inside URLs
* #74: Fixed parser to not treat single periods as decimal numbers
* #76: Fixed dummy element overlaping the content, even though it should be unobtrusive
0.4.13
-----
* #58: `forceHeight` now handles relative mode like a boss.
* #59: Make `scale` option only affect absolute mode.
0.4.12
-----
* #64: Setting `float` property using JavaScript didn't work across browser. Now using `styleFloat` and `cssFloat` properties.
0.4.11 (2012-09-17)
-----
* The `scale` option does not affect `constants`.
0.4.10
-----
* Allow smooth scrolling on element level using `data-smooth-scrolling`
0.4.9
-----
* Added experimental smooth scrolling (no more CSS transitions. WORKS IN IE.).
0.4.8
-----
* Added `stopAnimateTo` method.
0.4.7
-----
* Updated the requestAnimationFrame polyfill for smoother animations
* Updated the way requestAnimationFrame is used for even smoother animations
0.4.6
-----
* New method `relativeToAbsolute` which was formerly private
* New method `isAnimatingTo` to check if an animation caused by `animateTo` is running
* Added `sqrt` easing function
0.4.5
-----
* Experimental mobile support using https://github.com/zynga/scroller
0.4.4
-----
* A `skrollr` class is added to the HTML element and a `no-skrollr` class is removed when `init` is called. Useful for fallback styling.
0.4.3 (2012-08-02)
-----
* Added new feature "constants".
0.4.2 (2012-07-26)
-----
* Added new feature "anchor-target" which allows elements to react to other elements leaving/entering the viewport.
0.4.1 (2012-07-25)
-----
* Fixed a bug which broke skrollr in IE caused by wrong regular expression behavior
0.4.0 (2012-07-22)
-----
* *breaking* the `data-end-[offset]` syntax changed. It's now `data-[offset]-end`.
* Fixed a bug where white spaces between style declarations were not ignored.
* Added support for anchors. Animations can now be specified relative to the elements position within the viewport.
* Added support for SVG elements.
* Added new method `refresh()`.

View File

@ -1,21 +0,0 @@
The MIT License
Copyright (c) 2012-2014 Alexander Prinzhorn (@Prinzhorn)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,627 +0,0 @@
[![Build Status](https://secure.travis-ci.org/Prinzhorn/skrollr.png)](http://travis-ci.org/Prinzhorn/skrollr)
skrollr 0.6.26
=====
Stand-alone **parallax scrolling** JavaScript library for **mobile (Android, iOS, etc.) and desktop** in about 12k minified.
Designer friendly. No JavaScript skills needed. Just plain CSS and HTML.
_Actually, skrollr is much more than "just" **parallax scrolling**. It's a full-fledged scrolling animation library. In fact, you can use it and still have no parallax scrolling at all. But I wanted to sound hip and use some buzz-words. By the way, skrollr leverages HTML5 and CSS3 ;-)_
Resources
=====
Plugins
-----
### Official
* [skrollr-menu](https://github.com/Prinzhorn/skrollr-menu) - Hash navigation
* [skrollr-ie](https://github.com/Prinzhorn/skrollr-ie) - IE < 9 CSS fixes
* [skrollr-stylesheets](https://github.com/Prinzhorn/skrollr-stylesheets) - Keyframes inside CSS files
### Third party
* [skrollr-colors](https://github.com/FezVrasta/skrollr-colors) - Mix and match hex, rgb and hsl colors.
In the wild
-----
Check out the [wiki page](https://github.com/Prinzhorn/skrollr/wiki/In-the-wild) for websites using skrollr and feel free to add your own website :). You can also shamelessly add yourself to the list [here](https://github.com/Prinzhorn/skrollr/wiki/Agencies-and-freelancers) if you are offering paid skrollr support.
Further resources (tutorials etc.)
-----
Moved to the [wiki](https://github.com/Prinzhorn/skrollr/wiki/Resources).
Documentation
=====
First of all: look at the [examples and read the source ;-)](https://github.com/Prinzhorn/skrollr/tree/master/examples). This might give you a feeling of how stuff works and you can see how some patterns can be implemented.
Abstract
------
skrollr allows you to animate any CSS property of any element depending on the horizontal scrollbar position. All you need to do is define key frames for each element at certain points in top scroll offset.
Other libraries require you to write JavaScript in order to define your animations. This introduces two main problems:
* Animation and element are not at one place. In order to find out if any animations are defined for a given element, you have to scroll through many (sometimes thousands) of lines of JavaScript.
* You have to learn a new syntax which is often very verbose and limited at the same time.
With skrollr, you put the definition of your key frames right where they belong (to the element) using a syntax you already know (plain CSS).
If you would rather have the keyframes inside a separate file, take a look at [skrollr-stylesheets](https://github.com/Prinzhorn/skrollr-stylesheets).
Let's get serious
------
First of all you want to include the `skrollr.min.js` file at the bottom of your document (right before the closing `</body>`) and then call `skrollr.init()`. Or you can place it inside the `<head>` if you want to, but make sure to call `init()` once the document has been loaded (e.g. jQuery's `ready` event or even `window.onload`).
```html
<script type="text/javascript" src="skrollr.min.js"></script>
<script type="text/javascript">
var s = skrollr.init();
</script>
</body>
```
If you are using require.js to structure your project, you can use skrollr as a module as well.
```javascript
require(['skrollr'], function(skrollr){
var s = skrollr.init();
});
```
If you're familiar with CSS, you already know the `style` attribute. In order to create an animation you would need several, at least two, of them. That's what skrollr does. You use the HTML5 `data-` attributes to define multiple sets of styles (we call each of them **keyframe**) and skrollr interpolates between them.
#### Let's change the background-color of a `div` starting at `#00f` when the scrollbar is at the top and ending with `#f00` when the user scrolled 500 pixels down
```html
<div data-0="background-color:rgb(0,0,255);" data-500="background-color:rgb(255,0,0);">WOOOT</div>
```
[View in browser](http://prinzhorn.github.io/skrollr/examples/docu/1.html)
##### Lessons learned
* Skrollr ensures that you can actually scroll down 500 pixels or more, even if there's not enough content. You can suppress this by using the `forceHeight` option.
* You can't use `#00f` or `#0000ff`. You need to use `rgb` or `hsl` and explicitly decide which color space you want because they result in different animations (HSL is much cooler most of the time). Don't worry, the IE plugin teaches IE < 9 to display `rgb` and `hsl` correctly.
#### Now let's do a barrel roll at the same time
```html
<div data-0="background-color:rgb(0,0,255);transform:rotate(0deg);" data-500="background-color:rgb(255,0,0);transform:rotate(360deg);">WOOOT</div>
```
[View in browser](http://prinzhorn.github.io/skrollr/examples/docu/2.html)
##### Lessons learned
* Skrollr handles all these nasty CSS prefixes for you. Just -moz-relax and get yourself a cup of -webkit-coffee.
#### Now let the rotation bounce like it were a hip-hop video
```html
<div data-0="background-color:rgb(0,0,255);transform[bounce]:rotate(0deg);" data-500="background-color:rgb(255,0,0);transform[bounce]:rotate(360deg);">WOOOT</div>
```
[View in browser](http://prinzhorn.github.io/skrollr/examples/docu/3.html)
#### Lessons learned
* Skrollr allows non-linear animations. The so called *easing functions* can be used per-property by putting them in square brackets behind the property. There's a built-in list of easing functions (see below in the [JavaScript](#javascript) section) and you can use your own functions by using the `easings` options.
Now you may have noticed that using `500` as a keyframe position is kind of random and the look depends on your browser size.
#### Let's have the animation end when the top of the element reaches the top of the viewport (element leaves the viewport)
```html
<div data-0="background-color:rgb(0,0,255);transform[bounce]:rotate(0deg);" data-top="background-color:rgb(255,0,0);transform[bounce]:rotate(360deg);">WOOOT</div>
```
[View in browser](http://prinzhorn.github.io/skrollr/examples/docu/4.html)
##### Lessons learned
* Skrollr keyframes can either be [absolute](#absolute-mode-or-document-mode) or [relative](#relative-mode-or-viewport-mode).
That's the end of this short intro. The following sections will explain some more things in detail.
If you're not a fan of `data-attributes` or if you're planning a big website where you want a better and more flexible structure, take a look at [skrollr-stylesheets](https://github.com/Prinzhorn/skrollr-stylesheets).
Mobile support
-----
Starting with version 0.5.0 skrollr officially supports mobile browsers including Android and iOS. Furthermore, mobile support has been rewritten from scratch for skrollr 0.6.0.
### The Problem with mobile and the solution
(If you're not interested in the details, just scroll down a bit to see what you need to do for mobile support.)
Some words on why this is an important milestone and why others failed: Mobile browsers try to save battery wherever they can. That's why mobile browsers delay the execution of JavaScript while you are scrolling. iOS in particular does this very aggressively and completely stops JavaScript. In short, that's the reason why many scrolling libraries either don't work on mobile devices or they come with their own scrollbar which is a usability nightmare on desktop. It was an important requirement while I developed skrollr that I don't force you to scroll the way I want it. skrollr on desktop uses a native scrollbar and you can scroll the way you want to (keyboard, mouse, etc.).
You just told me it doesn't work on mobile, but why does it? The answer is simple. When using skrollr on mobile you don't actually scroll. When detecting a mobile browser, skrollr disables native scrolling and instead listens for touch events and moves the content (more specific the `#skrollr-body` element) using CSS transforms.
### What you need in order to support mobile browsers
Starting with skrollr 0.6.0 there's just one thing you need to do: Include an element on your page with the id `skrollr-body`. That's the element we move in order to fake scrolling. The only case where you don't need a `#skrollr-body` is when using `position:fixed` exclusively. In fact, the skrollr website doesn't include a `#skrollr-body` element. If you need both fixed and non-fixed (i.e. static) elements, put the static ones inside the `#skrollr-body` element.
Or to put it differently: On mobile the `skrollr-body` element is moved using CSS transforms. You can't have `position:fixed` or `background-attachment:fixed` inside elements which use CSS transforms as per CSS spec (http://meyerweb.com/eric/thoughts/2011/09/12/un-fixing-fixed-elements-with-css-transforms/). That's why those elements need to be **outside** of the `skrollr-body` element.
AMD
---
Starting with `0.6.22` there's experimental AMD support. Please note that only skrollr core has AMD support so far. We will update the plugins in the future.
```js
require(['skrollr'], function(skrollr){
skrollr.init();
});
```
Absolute vs relative mode
-----
Being only able to define key frames in absolute values is simply insufficient for some cases. For example, if you don't know exactly where an element will be in the document. That's why there are two modes for key frames, namely `absolute` and `relative` mode.
### absolute mode (or document mode)
The key frames are defined as absolute values describing how much the **document** has been scrolled down.
The syntax is `data-[offset]-[anchor]`, where `offset` can be any integer (0 is default) and `anchor` can be either `start` (default) or `end`. Either `offset` or `anchor` can be omitted in some situations. Here are some examples of key frames and their meaning.
* `data-0` = `data-start` = `data-0-start`: When the scroll top is 0.
* `data-100` = `data-100-start`: When the scroll top is 100.
* `data--100` = `data--100-start`: When the scroll top is -100 (sounds like nonsense, but keep in mind that interpolation will be relative to this point).
* `data-end` = `data-0-end`: When offset is 0, but counting from the bottom of the document instead of from the top. In short: when you reach the bottom of the page.
* `data-100-end`: 100px before we reach the bottom.
* `data--100-end`: 100px after we reach the bottom (again, it's up to you whether you need it).
### relative mode (or viewport mode)
Instead of defining key frames relative to the **document** (i.e. absolute), we are able to define them depending on the position of any element in relation to the **viewport**.
The syntax is `data-[offset]-(viewport-anchor)-[element-anchor]`, where `offset` can again be any integer and defaults to 0. Both `viewport-anchor` (mandatory) and `element-anchor` (optional) can be one of `top`, `center` or `bottom`. If `element-anchor` is omitted, the value of `viewport-anchor` will be taken (just like with background-position). Here are some examples of key frames and their meaning.
* `data-top` = `data-0-top` = `data-top-top` = `data-0-top-top`: When the element's top is aligned with the top of the viewport.
* `data-100-top` = `data-100-top-top`: When the element's top is 100px above the top of the viewport.
* `data--100-top` = `data--100-top-top`: When the element's top is 100px below the top of the viewport.
* `data-top-bottom `= `data-0-top-bottom`: When the bottom of the element is at the top of the viewport (it's just not visible).
* `data-center-center` = `data-0-center-center`: When the element is at the center of the viewport.
* `data-bottom-center` = `data-0-bottom-center`: When the element's center is at the bottom of the viewport, thus the upper half of the element is visible.
By default the element is the element where the key frames are defined on (self), but can be any element on the page. You can optionally specify which element you want by using the `data-anchor-target` and any CSS selector. The first element on the page matching the selector will be used. `data-anchor-target` requires IE 8 or greater.
Examples: `data-anchor-target="#foo"` or `data-anchor-target=".bar:not(.bacon) ~ span > a[href]"`
**Note**: If you need to support IE 7, then you may only use IDs as `anchor-target`s, i.e. `#foo`. The IE plugin maps `querySelector` to `getElementById`.
Here's an infographic for better understanding of anchors (click to open PDF):
[![Anchors Guide](https://raw.github.com/Prinzhorn/skrollr/master/guide/anchor-position-guide.png)](https://raw.github.com/Prinzhorn/skrollr/master/guide/anchor-position-guide.pdf)
**Important**: All those values will be calculated up-front and transformed to `absolute` mode. So if either the element's box height changes (height, padding, border) or the elements position within the document, you probably need to call `refresh()` (see documentation in JavaScript section below). **Window resizing is handled by skrollr.**
Percentage offsets
------------------
All offsets shown above are given in absolute pixel values, e.g. `data-300` for `300px` from the top or `data-13-top-bottom` for a `13px` offset to the `top-bottom` anchor. As of skrollr `0.6.13` you can also have offsets as percentages of the viewport by appending a `p` to the number. For example `data-75p` for when you scrolled down `75%` of the viewport or `data-10p-center` to have a `10%` offset from the `center` anchor.
Hash navigation
-----
Check out the [skrollr-menu](https://github.com/Prinzhorn/skrollr-menu) plugin.
Working with constants
-----
I was lying to you. The syntax for absolute mode is not `data-[offset]-[anchor]` and for relative mode it's not `data-[offset]-(viewport-anchor)-[element-anchor]`. In both cases, `offset` can be preceded by a constant which can be passed to the `ìnit` method. The name of the constant needs to be preceded with an underscore.
Example:
```js
skrollr.init({
constants: {
foobar: 1337
}
});
```
```html
<div data-_foobar="left:0%;" data-_foobar--100="left:50%;" data-_foobar-100="left:100%;"></div>
<!--Equal to-->
<div data-1337="left:0%;" data-1237="left:50%;" data-1437="left:100%;"></div>
```
Valid characters for a constant are `[a-z0-9_]`.
Dynamic constants
-----------------
Starting with skrollr `0.6.19` the word "constants" doesn't quite fit anymore, but who cares.
You can now use functions and percentages as constants. They are automatically evaluated when the window is resized or if you call `refresh`.
```js
skrollr.init({
constants: {
foo: function() {
//Note: you can access the skrollr instance with `this` for things like `this.relativeToAbsolute`
return Math.random() * 100;//trolololol
},
vh: '100p'
}
});
```
CSS classes
-----
skrollr will add a `skrollr` class to the `HTML` element when calling `init` and will remove a `no-skrollr` class if present. Additionally, it will add a `skrollr-desktop` or `skrollr-mobile` class depending on which it detects. This allows fallback CSS rules to create a good user experience on unsupported devices or when JavaScript or skrollr are disabled.
All elements under skrollr's control (elements with appropriate data-attributes) will get the `skrollable` class. In addition, we add either the `skrollable-before`, `skrollable-between` **or** `skrollable-after` class, depending on whether the current scroll position is before, between or after the first/last (smallest/largest) keyframe of an element.
Animating attributes
--------------------
Starting with skrollr 0.6.24 you can also animate attribute and not just style properties. This is especially a big thing because in the SVG world many properties are implemented as attributes and not in CSS. Animating an attribute couldn't be simplier, just prefix the property with an `@` symbol!
```html
<polygon
points='426,720 -200,720 -200,0 955,0'
data-0="@points:426,720 -200,720 -200,0 955,0"
data-500="@points:380,720 -200,720 -200,0 1302,0">
</polygon>
```
Note: as always, skrollr doesn't do any magic. It doesn't understand what a polygon or points are. It's only interpolating numbers, that's it. So make sure you have the same number of numbers in your keyframes (8 in this case).
Filling missing values
-----
Imagine the following animation
```html
<div data-100="left:0%;" data-200="top:0%;" data-300="left:50%;" data-400="top:50%;"></div>
```
One could expect `left` to have a value of `25%` at keyframe `200`. That is **not** the case. By design, skrollr only interpolates values between key frames which are direct **neighbors**. What actually happens is that skrollr internally fills out all holes once from left and then from right. So the above is equivalent to
```html
<div data-100="left:0%;top:0%;" data-200="left:0%;top:0%;" data-300="left:50%;top:0%;" data-400="left:50%;top:50%;"></div>
```
Preventing interpolation
-----
The reason why skrollr is so lightweight and powerful is because it literally interpolates **every** number it can find. If you want to prevent some side effect, you can suppress interpolation for a specific value by prepending an exclamation point.
Example:
```html
<!-- This will get your image url f***** up because there's no "kitten1.4561799.jpg" and the like -->
<div data-0="background-image:url(kitten1.jpg);" data-100="background-image:url(kitten2.jpg)"></div>
<!-- Better -->
<div data-0="background-image:!url(kitten1.jpg);" data-100="background-image:!url(kitten2.jpg)"></div>
```
**Note:** The values for both keyframes (if they contain a number) need to be prefixed if you want to avoid skrollr throwing an exception at you!
Limitations
-----
There are some limitations of skrollr you should be aware of.
* All numeric values have to have the same unit, even `0` needs a unit. It's not possible to animate from `5%` to `100px`. skrollr won't complain, but results are undefined.
* Animations between values which are composed of multiple numeric values like `margin:0 0 0 0;` are only possible for the same number of values. `margin:0px 0px 0px 0px;` to `margin:0px 100px 50px 3px;` is fine, but not `margin:10px;` to `margin:5px 10px;`.
* Animations between CSS transforms only work when they use the same functions in same order. From `rotate(0deg) scale(1)` to `rotate(1000deg) scale(5)` is fine.
* Color animations don't support named values like "red" or hex values like "#ff0000". Instead, you have to use `rgb()`, `rgba()`, `hsl()` and `hsla()`. Don't worry, there's a skrollr plugin for IE < 9 to support `hsl()` (without "a"!) and to fall rgba back to rgb.
* Color animations only work for same color functions. `hsl()` to `hsl()` or `hsla()` is fine, but not `rgb()` to `hsl()`. Which makes sense, because animating from the same colors in rgb space and in hsl space results in different animations (hsl gives you the nice rainbow stuff).
But feel free to send in a pull request to fix any of them. Just keep in mind that keeping skrollr as lightweight as possible has high priority.
JavaScript
====
On the JavaScript part there's not much to do (you can, if you want to!). So if you only know CSS and HTML, perfect.
skrollr.init([options])
-----
All there is to do is to call `skrollr.init([options]);` which returns an instance of the singleton skrollr class. Subsequent calls to `init()` will just return the same skrollr instance again.
Possible options for `init()` are
### smoothScrolling=true
Smooth scrolling smoothens your animations. When you scroll down 50 pixels, the animations will transition instead of jumping to the new position.
The global setting can be overridden per element by setting `data-smooth-scrolling` to `on` or `off`.
### smoothScrollingDuration=200
The number of milliseconds the animations run after the scroll position changed the last time.
### constants={}
An object containing integers as values. The keys can contain `[a-z0-9_]`. They *do not* need a leading underscore.
Example: `data-_myconst-200` and `skrollr.init({constants: {myconst: 300}})` result in `data-500`.
### scale=1
By default, skrollr uses the largest key frame and makes document height + viewport height this high, thus the max possible scroll top offset. If your animation runs too fast or too slow, just adjust the scale value.
`scale` only affects keyframes in absolute mode.
When `forceHeight` is set to false, `scale` is ignored.
`scale` affects `constants` as well.
`scale` does only affect key frames in absolute mode, e.g. `data-500` but not `data-top`.
###forceHeight=true
`true`: Make sure the document is high enough that all key frames fit inside. Example: You use `data-1000`, but the content only makes the document 500px high. skrollr will ensure that you can scroll down the whole 1000px. Or if you use relative mode, e.g. `data-top-bottom`, skrollr will make sure the bottom of the element can actually reach the top of the viewport.
`false`: Don't manipulate the document and just keep the natural scrollbar.
###mobileCheck=function() {...}
This option allows you to pass a function to skrollr overwriting the check for mobile devices. The function should return `true` when mobile scrolling should be used and `false` if not.
The default looks like this
```js
function() {
return (/Android|iPhone|iPad|iPod|BlackBerry/i).test(navigator.userAgent || navigator.vendor || window.opera);
}
```
### mobileDeceleration=0.004
The amount of deceleration for momentum scrolling on mobile devices. This options tells skrollr how fast or slow you want the scrolling to stop after the user lifted his finger.
Set it to `1` to disable momentum scrolling.
### edgeStrategy='set'
This option specifies how to handle animations when the scroll position is outside the range on the keyframes (i.e. before the first or after the last keyframe).
One of three options are possible
* `set` _(default)_: When before/after the first/last keyframe, apply the styles of the first/last keyframe to the element.
* `ease`: Same as set, but the values will be transformed using the given easing function.
* `reset`: When before/after the first/last keyframe, apply the styles which the element had before skrollr did anything. This means resetting the class attribute as well as removing all styles which have been applied to the `style` property. This means the element won't have any `skrollable-*` CSS classes.
Example:
Given the following element with two keyframes
```html
<div data-1000="left:0%;top:0%;" data-2000="left:50%;top:100%;" style="left:-100%;" class="section"></div>
```
and the following easing function which always returns `0.5` (I know it's pointless, but it's just an example. A real world example would be an easing function that represents a curve and starts somewhere between `0` and `1`, but not at `1`)
```js
function(p) {
return 0.5;
}
```
and imagine the scrollbar is at `237`, which is below the first keyframe which is at `1000`.
* `set` will result in `<div style="left:0%;top:0%;" class="section skrollable skrollable-before"></div>` which is plain `data-1000`.
* `ease` will result in `<div style="left:25%;top:50%;" class="section skrollable skrollable-before"></div>` which is `0.5 * data-1000`.
* `reset` will result in `<div style="left:-100%;" class="section"></div>` which is what the element originally had. Note how `top` is missing.
### beforerender
A listener function that gets called each time right before we render everything. The function will be passed an object with the following properties:
```js
{
curTop: 10, //the current scroll top offset
lastTop: 0, //the top value of last time
maxTop: 100, //the max value you can scroll to. curTop/maxTop will give you the current progress.
direction: 'down' //either up or down
}
```
Returning `false` will prevent rendering.
### render
A listener function that gets called right after we finished rendering everything. The function will be passed with the same parameters as `beforerender`.
Example
```js
skrollr.init({
render: function(data) {
//Log the current scroll position.
console.log(data.curTop);
}
});
```
### keyframe
**Experimental**
In order to receive `keyframe` events from an element, add the `data-emit-events` attribute to the element. The keyframe function will be called with three arguments
1. The `element` that passed the keyframe.
2. The `name` of the keyframe, camel-cased (see example).
3. The `direction` the user is scrolling.
Example:
```html
<div
data-500="..."
data-top-bottom="..."
data-_offset-center="..."
data-emit-events
>
Some content
</div>
```
```js
skrollr.init({
keyframe: function(element, name, direction) {
//name will be one of data500, dataTopBottom, data_offsetCenter
}
});
```
Note: this is experimental, expect the API to change! Originally I wanted to emit the events right on the element, so you could do this
```js
//Wouldn't this be nice?
document.querySelector('#foo').addEventListener('skrollr.dataTopBottom.up', function() {
//#foo just passed the data-top-bottom keyframe while scrolling up
}, false)
```
but IE.
### easing
An object defining new easing functions or overwriting existing ones. Easing functions get just one argument, which is a value between 0 and 1 (the percentage of how much of the animation is done). The function should return a value between 0 and 1 as well, but for some easings a value less than 0 or greater than 1 is just fine.
An easing function basically transforms the timeline for an animation. When the animation should be 50% done, you can transform it to be 90% done or whatever your function does.
Example:
```js
skrollr.init({
easing: {
//This easing will sure drive you crazy
wtf: Math.random,
inverted: function(p) {
return 1 - p;
}
}
});
```
You can now use the easing functions like any other.
skrollr ships with some built in functions:
* linear: The default. Doesn't need to be specified.
* quadratic: To the power of two. So 50% looks like 25%.
* cubic: To the power of three. So 50% looks like 12.5%
* begin/end: They always return 0 or 1 respectively. No animation.
* swing: Slow at the beginning and accelerates at the end. So 25% -> 14.6%, 50% -> 50%, 75% -> 85.3%
* sqrt: Square root. Starts fast, slows down at the end.
* outCubic
* bounce: Bounces like a ball. See https://www.desmos.com/calculator/tbr20s8vd2 for a graphical representation.
skrollr.get()
-----
Returns the skrollr instance if `init()` has been called before or `undefined`.
Public API
-----
Calling `init()` returns an instance of skrollr which exposes a public api.
### refresh([elements])
Reparses all given `elements`. You can pass a single element or an array-like element (Array, NodeList or jQuery object)
Useful when
* Elements in `relative` mode change and need to be updated.
* Data-attributes are manipulated dynamically.
* New elements are added to the DOM and should be controlled by skrollr.
When no `elements` are given, all elements in the document will be parsed again. In fact, when calling `skrollr.init()` skrollr uses `refresh()` without parameters internally.
Time consuming operations, should not be called on every rendering.
### relativeToAbsolute(element, viewportAnchor, elementAnchor)
Returns an integer which represents the absolute scroll position which correlates to the relative anchor.
`element` must be a DOM element.
`viewportAnchor` and `elementAnchor` must be one of `top`, `center` or `bottom`
Example:
```js
var offset = s.relativeToAbsolute(document.getElementById('foo'), 'top', 'bottom');
//offset contains the scroll position at which #foo's bottom is at the top of the viewport.
//If you now use setScrollTop(offset) or animateTo(offset) #foo's bottom will be perfectly aligned with the top of the viewport. Yay.
```
### getScrollTop()
Returns the current scroll offset in pixels. Normalizes different browser quirks and handles mobile scrolling.
### getMaxScrollTop()
Returns the number of pixels that can be scrolled down in total. If `forceHeight` is true, that's usually the largest keyframe. Otherwise it's the height of the document minus the viewport height.
### setScrollTop(top[, force = false])
Sets the top offset using `window.scrollTo(0, top)` on desktop or updating the internal state in case of mobile scrolling.
When `force` is set to `true`, skrollr will jump to the new position without any kind of transition. By default, the global `smoothScrolling` setting applies.
### isMobile()
Returns if skrollr runs in mobile mode (see also `mobileCheck` option).
### animateTo(top[, options])
Animates the scroll position from current position to `top`. Possible `options` are
#### duration
How long the animation should run in milliseconds. The default is `1000` or one second.
#### easing
The name of an easing function. The same functions can be used as for property animations. Default is `linear` .
#### done
A function to be called after the animation finished. When you pass a `top` value, which is the same as the current, then the function will be called immediately. The function gets a boolean argument `interrupted` which indicates if the animation was interrupted by `stopAnimateTo` or finished to the end.
### stopAnimateTo()
Stops the animation and calls the `done` callback passing `true` as `interrupted` arguments.
### isAnimatingTo()
Returns if an animation caused by animateTo is running.
### on(name, fn)
Set a listener function for one of the events described in the options section (beforerender, render, keyframe). Only one listener can be attached at a given time. This method overwrites the current listener, if any.
### off(name)
Removes the listener for the given event.
### destroy()
Destroys skrollr. All `class` and `style` attributes will be set to the values they had before.
Changelog
=====
See [HISTORY.md](https://github.com/Prinzhorn/skrollr/blob/master/HISTORY.md).

View File

@ -1,28 +0,0 @@
{
"name": "skrollr",
"homepage": "http://prinzhorn.github.io/skrollr/",
"authors": [
"Alexander Prinzhorn"
],
"description": "Stand-alone parallax scrolling library for mobile (Android + iOS) and desktop",
"main": "src/skrollr.js",
"moduleType": [
"globals"
],
"keywords": [
"parallax",
"scroll",
"animation",
"html5",
"css3",
"transition"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}

File diff suppressed because one or more lines are too long

View File

@ -1,14 +0,0 @@
Examples
------
Showcasing the awesomeness of skrollr.
* [The "main" example](http://prinzhorn.github.io/skrollr/)
* ["Classic" parallax with different sections and parallax images between the gaps](http://prinzhorn.github.io/skrollr/examples/classic.html)
* [Demonstrating different anchors](http://prinzhorn.github.io/skrollr/examples/anchors.html)
* [Demonstrating data-anchor-target](http://prinzhorn.github.io/skrollr/examples/anchor_target.html)
* [Pausing the scrolling for a moment to do other animations](http://prinzhorn.github.io/skrollr/examples/pausing.html)
* [Drawing a SVG path](http://prinzhorn.github.io/skrollr/examples/path.html)
* [Using two custom easing functions to create a circular motion](http://prinzhorn.github.io/skrollr/examples/circular_motion.html)
* [Parallax background with constant speed](http://prinzhorn.github.io/skrollr/examples/bg_constant_speed_less.html)
* [gradientsmotherfucker](http://prinzhorn.github.io/skrollr/examples/gradientsmotherfucker.html)

View File

@ -1,74 +0,0 @@