Create a gist now

Instantly share code, notes, and snippets.

PointerEvents for less than IE10
$(function(){
var pointer = new PointerEvent();
pointer.load();
});
function PointerEvent(){
this.userAgent = window.navigator.userAgent.toLowerCase();
this.appVersion = window.navigator.appVersion.toLowerCase();
this.target = $('.cp-image');
this.pointer = $('.click-shield');
}
PointerEvent.prototype.load = function(){
var self = this;
self.init();
self.exe();
};
PointerEvent.prototype.init = function(){
var self = this;
if(self.userAgent.indexOf("msie") !== -1) {
if(self.appVersion.indexOf("msie 10.") !== -1) {
self.addedClass();
} else if(self.appVersion.indexOf("msie 9.") !== -1) {
self.addedClass();
} else if(self.appVersion.indexOf("msie 8.") !== -1) {
self.addedClass();
}
}
};
PointerEvent.prototype.addedClass = function() {
var self = this;
self.target.addClass('click-shield');
};
PointerEvent.prototype.exe = function(){
var self = this;
if(self.target.hasClass('click-shield')){
self.target.on('click', 'a', $.proxy(self.event, self));
}
};
PointerEvent.prototype.event = function(e){
e.preventDefault();
e.stopPropagation();
};
.click-shield a {
cursor: default;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment