Skip to content

Commit

Permalink
Better iPhone/iPad support
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish committed Jul 30, 2011
1 parent 2ce0d0f commit d0e4f42
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
8 changes: 5 additions & 3 deletions fathom.js
@@ -1,10 +1,11 @@
/*
Fathom.js v1.2.1
Fathom.js v1.2.2
Copyright 2011, Mark Dalgleish
This content is released under the MIT License
github.com/markdalgleish/fathom/blob/master/MIT-LICENSE.txt
*/

(function($, window, undefined){
var Fathom = function(container, options){
this.container = container;
Expand Down Expand Up @@ -331,6 +332,7 @@ github.com/markdalgleish/fathom/blob/master/MIT-LICENSE.txt
var self = this,
slideSelector = self.config.slideTagName + (self.config.slideClass ? '.' + self.config.slideClass : ''),
$scrollContainer = this.config.portable ? this.$portableContainer : $window,
isIOS = navigator.userAgent.match(/like Mac OS X/i) === null ? false : true,
$elem;

self.scrolling = false;
Expand All @@ -345,8 +347,8 @@ github.com/markdalgleish/fathom/blob/master/MIT-LICENSE.txt
var offsetX = self.config.portable ? $scrollContainer.position().left : 0,
offsetY = self.config.portable ? $scrollContainer.position().top : 0,
midpoint = {
x: offsetX + ($scrollContainer.width() / 2),
y: offsetY + ($scrollContainer.height() / 2)
x: offsetX + ($scrollContainer.width() / 2) + (isIOS ? $window.scrollLeft() : 0),
y: offsetY + ($scrollContainer.height() / 2) + (isIOS ? $window.scrollTop() : 0)
};

$elem = $(document.elementFromPoint(midpoint.x, midpoint.y));
Expand Down
5 changes: 2 additions & 3 deletions fathom.min.js

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

16 changes: 15 additions & 1 deletion fathom.sample.css
Expand Up @@ -78,4 +78,18 @@ div.slide {
}
div.activeslide {
opacity: 1;
}
}

/* iPad */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
div.inactiveslide {
opacity: 1;
}
}

/* iPhone */
@media only screen and (max-device-width: 480px) {
div.inactiveslide {
opacity: 1;
}
}

0 comments on commit d0e4f42

Please sign in to comment.