Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions jquery.djax.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
// ==/ClosureCompiler==
// http://closure-compiler.appspot.com/home

(function ($, exports) {
;(function ($, exports) {
'use strict';

$.fn.djax = function (selector, exceptions, replaceBlockWithFunc) {
Expand Down Expand Up @@ -85,6 +85,9 @@

// From this point on, we handle the behaviour
event.preventDefault();

//Allow for touch events - http://stackoverflow.com/a/11507558
event.stopPropagation();

// If we're already doing djaxing, return now and silently fail
if (self.djaxing) {
Expand Down Expand Up @@ -143,9 +146,10 @@
newBlock = newBlocks.filter(id),
block = $(this);

// Only add a class to internal links and allow for touch events - http://stackoverflow.com/a/11507558
$('a', newBlock).filter(function () {
return this.hostname === location.hostname;
}).addClass('dJAX_internal').on('click', function (event) {
}).addClass('dJAX_internal').on('click touchstart', function (event) {
return self.attachClick(this, event);
});

Expand Down Expand Up @@ -182,10 +186,10 @@
}
}

// Only add a class to internal links
// Only add a class to internal links and allow for touch events - http://stackoverflow.com/a/11507558
$('a', newBlock).filter(function () {
return this.hostname === location.hostname;
}).addClass('dJAX_internal').on('click', function (event) {
}).addClass('dJAX_internal').on('click touchstart', function (event) {
return self.attachClick(this, event);
});

Expand Down Expand Up @@ -216,10 +220,10 @@
});
}; /* End self.navigate */

// Only add a class to internal links
// Only add a class to internal links and allow for touch events - http://stackoverflow.com/a/11507558
$(this).find('a').filter(function () {
return this.hostname === location.hostname;
}).addClass('dJAX_internal').on('click', function (event) {
}).addClass('dJAX_internal').on('click touchstart', function(event){
return self.attachClick(this, event);
});

Expand Down