Skip to content

Commit

Permalink
- Solved problem with navigation bullets #38
Browse files Browse the repository at this point in the history
- Added compatibility for IE 11 touch screen #34
  • Loading branch information
alvarotrigo committed Feb 18, 2015
1 parent 647fece commit 863f3b8
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 34 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pagePiling.js",
"version": "1.0",
"version": "1.2",
"homepage": "https://github.com/alvarotrigo/pagePiling.js",
"authors": [
"Alvaro Trigo https://github.com/alvarotrigo"
Expand Down
37 changes: 24 additions & 13 deletions jquery.pagepiling.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ===========================================================
* pagepiling.js 1.0
* pagepiling.js 1.2
*
* https://github.com/alvarotrigo/pagePiling.js
* MIT licensed
Expand All @@ -9,7 +9,7 @@
* ========================================================== */

(function ($) {
$.fn.pagepiling = function (options) {
$.fn.pagepiling = function (custom) {
var container = $(this);
var lastScrolledDestiny;
var lastAnimation = 0;
Expand All @@ -22,7 +22,7 @@
var scrollDelay = 600;

// Create some defaults, extending them with any options that were provided
options = $.extend({
options = $.extend(true, {
direction: 'vertical',
menu: null,
verticalCentered: true,
Expand All @@ -34,10 +34,10 @@
loopTop: false,
css3: true,
navigation: {
'textColor': '#000',
'bulletsColor': '#000',
'position': 'right',
'tooltips': ['section1', 'section2', 'section3', 'section4']
textColor: '#000',
bulletsColor: '#000',
position: 'right',
tooltips: null
},
normalScrollElements: null,
normalScrollElementTouchThreshold: 5,
Expand All @@ -50,7 +50,7 @@
afterLoad: null,
onLeave: null,
afterRender: null
}, options);
}, custom);


//easeInQuart animation included in the plugin
Expand Down Expand Up @@ -709,15 +709,26 @@
return events;
}

/**
* As IE >= 10 fires both touch and mouse events when using a mouse in a touchscreen
* this way we make sure that is really a touch event what IE is detecting.
*/
function isReallyTouch(e){
//if is not IE || IE is detecting `touch` or `pen`
return typeof e.pointerType === 'undefined' || e.pointerType != 'mouse';
}

/**
* Getting the starting possitions of the touch event
*/
function touchStartHandler(event){

var e = event.originalEvent;
var touchEvents = getEventsPage(e);
touchStartY = touchEvents['y'];
touchStartX = touchEvents['x'];

if(isReallyTouch(e)){
var touchEvents = getEventsPage(e);
touchStartY = touchEvents['y'];
touchStartX = touchEvents['x'];
}
}

/* Detecting touch events
Expand All @@ -726,7 +737,7 @@
var e = event.originalEvent;

// additional: if one of the normalScrollElements isn't within options.normalScrollElementTouchThreshold hops up the DOM chain
if (!checkParentForNormalScrollElement(event.target)) {
if ( !checkParentForNormalScrollElement(event.target) && isReallyTouch(e) ) {
event.preventDefault();

var activeSection = $('.pp-section.active');
Expand Down

0 comments on commit 863f3b8

Please sign in to comment.