Ich habe ein jQuery-Plugin an ein Element angehängt, und ich möchte dieses Plugin daran hindern, nur auf Mobile zu arbeiten. Ich habe auch ein anderes Plugin, eine Light Box, aber ich möchte bleiben, egal ob jemand auf dem Handy oder auf dem Desktop ist.jQuery-Plugin nur auf Mobilgeräten deaktivieren?
Dies ist das Plugin ich auf Mobil stoppen will: https://github.com/mattbryson/TouchSwipe-Jquery-Plugin
Hier ist der Code:
// Adding in the plugin
$(function() {
$(playlist).swipe({
swipeStatus:function(event, phase, direction, distance, duration) {
// code for swipy stuff here ....
// ...
// ...
}
});
// Trying to remove the plugin
window.onresize = function(event) {
var deviceWidth = $(window).width();
if(deviceWidth <= 768) {
$(playlist).swipe({
swipeStatus:function(event, phase, direction, distance, duration) {
event.preventDefault();
event.stopPropagation();
},
threshold: 0,
fingers:'all'
});
}
};
Lassen Sie mich wissen, wenn Sie irgendwelche Ideen bekommen. Ich habe auch versucht, die Playlist zu entfernen und wieder an das DOM anzuhängen, und das hat auch nicht funktioniert.
Danke!