Skip to content
This repository has been archived by the owner on Jan 24, 2018. It is now read-only.

Commit

Permalink
Added IE 7 support for anchor-targets. fixes #66
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Prinzhorn committed Nov 13, 2012
1 parent 535f8f3 commit bff7166
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![Build Status](https://secure.travis-ci.org/Prinzhorn/skrollr.png)](http://travis-ci.org/Prinzhorn/skrollr)

skrollr (v 0.5.2)
skrollr (v 0.5.3)
=====

Stand-alone **parallax scrolling** lib for **mobile (Android + iPhone) and desktop** in just over **3.4k** (gzipped) for desktop. And another 6.5k for **mobile support** (which is optional).
Expand Down Expand Up @@ -131,6 +131,8 @@ By default the element is the element where the key frames are defined on (self)

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)
Expand Down Expand Up @@ -381,6 +383,11 @@ Removes the listener for the given event.
Changelog
=====

0.5.3
-----

* #66: Make IE 7 support a light version of `data-anchor-target` by mapping `querySelector` to `getElementById`.

0.5.2
-----

Expand Down
4 changes: 2 additions & 2 deletions dist/skrollr.ie.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dist/skrollr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/banner/skrollr.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/*! skrollr v0.5.2 https://github.com/Prinzhorn/skrollr | free to use under terms of MIT license */
/*! skrollr v0.5.3 https://github.com/Prinzhorn/skrollr | free to use under terms of MIT license */
15 changes: 13 additions & 2 deletions src/plugins/skrollr.ie.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
*
* free to use under terms of MIT license
*/
(function(skrollr) {
(function(document, skrollr) {
var rxHSLAColor = /hsla?\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)%\s*,\s*(-?[\d.]+)%.*?\)/g;
var rxRGBAColor = /rgba?\(\s*(-?[\d.]+%?)\s*,\s*(-?[\d.]+%?)\s*,\s*(-?[\d.]+%?).*?\)/g;
var rxID = /^#[^\s]+$/;

var _setStyle = skrollr.setStyle;

Expand Down Expand Up @@ -107,4 +108,14 @@
}
};

}(window.skrollr));
/*
A really bad polyfill. But the main use-case for data-anchor-target are IDs.
*/
document.querySelector = document.querySelector || function(selector) {
if(!rxID.test(selector)) {
throw 'Unsupported selector "' + selector + '". The querySelector polyfill only works for IDs.';
}

return document.getElementById(selector.substr(1));
};
}(document, window.skrollr));
Loading

0 comments on commit bff7166

Please sign in to comment.