/* Submit Buttons ausblenden und auto submit fuer Selectfelder" -----------------------------------------------------*/ $(function() { // find Forms $('form').each(function() { var oForm = this; var oSubmit = $('input:image.abschicken'); //if this form has a image submit .. if (oSubmit.length) { // oSubmit.hide(); // ..hide image $('select', oForm).change(function() { // .. submit on change oForm.submit(); }); } }); // scollable DIV around Tables $('div.overflowAuto').each(function scollableTable(index) { var scrollStep = 250; var $div = $(this); var $table = $div.find('table'); var $scrollLeft = $(''); var $scrollText = 'Daten anzeigen' var $scrollRight = $(''); $scrollLeft.click(function() { var leftPos = $div.scrollLeft(); var newPos = leftPos - scrollStep; newPos = (newPos<0) ? 0 : newPos; $div.animate({ scrollLeft: newPos }, 500); return false; }); $scrollRight.click(function() { var leftPos = $div.scrollLeft(); var newPos = leftPos + scrollStep; $div.animate({ scrollLeft: newPos }, 500); return false; }); // Append to DOM var $ButtonContainer = $('
').append($scrollLeft, $scrollText, $scrollRight).insertBefore($div); // show or hide Buttons and watch for resize function watchResize() { if ($div.width() < $table.width()) { $ButtonContainer.show(); } else { $ButtonContainer.hide(); }; }; watchResize(); $(window).on('resize',watchResize); }); });