Permalink
Browse files

Mobile fixes

  • Loading branch information...
1 parent 1d4d7ad commit e7b41692f578edda1b8b7b25f188da50c80c442c @javve committed Mar 5, 2014
Showing with 18 additions and 6 deletions.
  1. +1 −1 static/style.css
  2. +17 −5 templates/layout.mustache
View
@@ -105,7 +105,6 @@ b {
position: absolute;
z-index: 1;
-webkit-tap-highlight-color: rgba(0,0,0,0);
- width: 15000px;
height: 100%;
-webkit-transform: translateZ(0);
-moz-transform: translateZ(0);
@@ -678,6 +677,7 @@ only screen and ( min-resolution: 2dppx) {
body {
padding-top:80px;
left:auto !important;
+ overflow: visible;
}
.burger,
.search-box {
@@ -168,7 +168,8 @@ $('.tictail_variations_select').dropkick({
<script>
-var device;
+var device,
+ scroll = null;
var init = {
start: function() {
@@ -177,8 +178,14 @@ var init = {
} else {
init.mobile();
}
+ if (document.addEventListener) {
+ document.addEventListener('touchmove', function (e) {
+ if (scroll) {
+ e.preventDefault();
+ }
+ }, false);
+ }
set.lightbox();
- set.horizontalScroll();
set.search();
$('.burger').click(set.burger);
},
@@ -194,6 +201,7 @@ var init = {
init.reset();
}
device = "desktop";
+ set.horizontalScroll();
set.bodyHeight();
set.pageWidth();
if ($('#products').size() > 0) {
@@ -204,6 +212,7 @@ var init = {
set.productPageWidth();
}
set.placeFooter();
+ scroll.refresh();
},
mobile: function() {
if (device !== "mobile") {
@@ -214,6 +223,8 @@ var init = {
reset: function() {
var navigation = $('.navigation');
if (device == "desktop") {
+ scroll.destroy();
+ scroll = null;
navigation.removeClass('open');
$('body').removeClass('navigation-open');
navigation.hide();
@@ -242,7 +253,7 @@ var set = {
});
},
horizontalScroll: function() {
- if ($("html, body, *").mousewheel) {
+ if ($("html, body, *").mousewheel) { // IE
var wait = false;
$("html, body, *").mousewheel(function(e, delta) {
var target = e.target || e.srcElement;
@@ -256,8 +267,9 @@ var set = {
}
});
} else {
- document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
- new IScroll('.content_container', { scrollX: true, scrollY: false, mouseWheel: true });
+ if (device === "desktop" && scroll == null) {
+ scroll = new IScroll('.content_container', { scrollX: true, scrollY: false, mouseWheel: true });
+ }
}
},
bodyHeight: function() {

0 comments on commit e7b4169

Please sign in to comment.