$(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: 'http://192.168.178.39/downloads/getDownload', data: { id: id }, beforeSend: function () { $('ul#downloadSlider a.active').removeClass("active"); $('#download-container > div').fadeOut(); $('#download-container').html("

Loading...

"); $('#download-container h2').fadeIn(); }, error: function () { $('#download-container').html("

Fehler! Download-Informationen konnten aufgrund eines unbekannten Fehlers nicht geladen werden!

Bitte versuche es später erneut oder kontaktiere das Website-Team!

"); }, success: function (data) { $('#download-container').html(''); $('#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); }); }); });