Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/assets/js/download.js

63 lines
2.2 KiB
JavaScript

$(document).ready(function () {
var downloadSlider = $('#downloadSlider').lightSlider({
auto: true,
autoWidth: true,
loop: true,
pauseOnHover: true,
controls: true,
enableTouch: true,
enableDrag: true
});
$('#downloadSlider').css('min-height', '400px');
});
function activateDownloadSlider() {
var downloadSlider = $('#downloadSlider').lightSlider({
auto: true,
autoWidth: true,
loop: true,
pauseOnHover: true,
controls: true,
enableTouch: false,
enableDrag: false
});
}
var loadDownloadInfo = function (id) {
$.ajax({
url: '/downloads/getDownload',
data: {
id: id
},
beforeSend: function () {
$('ul#downloadSlider a.active').removeClass("active");
$('#download-container > div').fadeOut();
$('#download-container').html("<h2 style='display: none;'><i class='fa fa-refresh fa-spin'></i> Loading...</h2>");
$('#download-container h2').fadeIn();
},
error: function () {
$('#download-container').html("<h2 class='text-danger'>Fehler! Download-Informationen konnten aufgrund eines unbekannten Fehlers nicht geladen werden!</h2><h3>Bitte versuche es später erneut oder kontaktiere das Website-Team!</h3>");
},
success: function (data) {
$('#download-container').html('<div id="info-' + id + '" style="display: none;">' + data + '</div>');
$('#info-' + id).fadeIn();
$('.image-container').removeClass('active');
$('#download-' + id + ' .image-container').addClass("active");
$('html, body').animate({
scrollTop: $("#download-container").offset().top - 80
}, 1000);
}
});
};
var sliderItem = $('#downloadSlider a');
sliderItem.each(function () {
$(this).on('mousedown', function (evt) {
$(this).on('mouseup mousemove', function handler(evt) {
if (evt.type === 'mouseup') {
loadDownloadInfo($(this).attr("data-id"));
}
$(this).off('mouseup mousemove', handler);
});
});
});