Skip to content
Permalink
Browse files

Add user agent detection to setLeft, update IE readme

  • Loading branch information...
fchasen committed Jan 24, 2015
1 parent da11659 commit f2fa7497939e5876ff6676cf8de34d7284498495
Showing with 31 additions and 2 deletions.
  1. +24 −1 README.md
  2. +7 −1 src/render_iframe.js
@@ -34,7 +34,7 @@ If you plan on using compressed (zipped) epubs (any .epub file) include the mini

```html
<!-- Zip JS -->
<script src="/build/libs/zip.min.js"></script>
<script src="/build/libs/zip.min.js"></script>
```

Setup a element to render to:
@@ -58,6 +58,29 @@ See the [Documentation](https://github.com/futurepress/epub.js/blob/master/docum

The [Examples](https://github.com/futurepress/epub.js/tree/master/examples) are likely the best place to learn how to use the library.

Internet Explore
-------------------------

Compatibility with IE requires wicked-good-xpath, a Google-authored pure JavaScript implementation of the DOM Level 3 XPath specification. More info at https://code.google.com/p/wicked-good-xpath/

You can download the latest wgxpath [here](https://wicked-good-xpath.googlecode.com/svn/trunk/build/wgxpath.install.js) or from the examples folder.

```html
<script src="/examples/wgxpath.install.js"></script>
```

Then install wgxpath via a hook like the one below:

```javascript
EPUBJS.Hooks.register("beforeChapterDisplay").wgxpath = function(callback, renderer){
wgxpath.install(renderer.render.window);
if(callback) callback();
};
wgxpath.install(window);
```

Recent Updates
-------------------------
@@ -146,7 +146,13 @@ EPUBJS.Render.Iframe.prototype.setLeft = function(leftPos){
// this.bodyEl.style.marginLeft = -leftPos + "px";
// this.docEl.style.marginLeft = -leftPos + "px";
// this.docEl.style[EPUBJS.Render.Iframe.transform] = 'translate('+ (-leftPos) + 'px, 0)';
this.document.defaultView.scrollTo(leftPos, 0);

if (navigator.userAgent.match(/(iPad|iPhone|iPod|Mobile|Android)/g)) {
this.docEl.style["-webkit-transform"] = 'translate('+ (-leftPos) + 'px, 0)';
} else {
this.document.defaultView.scrollTo(leftPos, 0);
}

};

EPUBJS.Render.Iframe.prototype.setStyle = function(style, val, prefixed){

0 comments on commit f2fa749

Please sign in to comment.
You can’t perform that action at this time.