function newsscoller(prev) { //Get the current selected item (with selected class), if none was found, get the first item var current_image = $('#gallery li.selected').length ? $('#gallery li.selected') : $('#gallery li:first'); var current_excerpt = $('#excerpt li.selected').length ? $('#excerpt li.selected') : $('#excerpt li:first'); //if prev is set to 1 (previous item) if (prev) { //Get previous sibling var next_image = (current_image.prev().length) ? current_image.prev() : $('#gallery li:last'); var next_excerpt = (current_excerpt.prev().length) ? current_excerpt.prev() : $('#excerpt li:last'); //if prev is set to 0 (next item) } else { //Get next sibling var next_image = (current_image.next().length) ? current_image.next() : $('#gallery li:first'); var next_excerpt = (current_excerpt.next().length) ? current_excerpt.next() : $('#excerpt li:first'); } //clear the selected class $('#excerpt li, #gallery li').removeClass('selected'); //reassign the selected class to current items next_image.addClass('selected'); next_excerpt.addClass('selected'); //Scroll the items $('#mask-gallery').scrollTo(next_image, 800); $('#mask-excerpt').scrollTo(next_excerpt, 800); } $(document).ready(function() { $('input').keydown(function(e){ if (e.keyCode == 13) { $(this).parents('form').submit(); return false; } }); $("ul#topnav li").hover(function() { $(this).css({ 'background' : '#1376c9 url(css/images/topnav_active.gif) repeat-x'}); $(this).find("span").fadeIn(); } , function() { //on hover out... $(this).css({ 'background' : 'none'}); $(this).find("span").hide(); }); $("ul#botnav li").hover(function() { $(this).css({ 'background' : ' url(css/images/botnav_active.gif) repeat-x'}); } , function() { //on hover out... $(this).css({ 'background' : 'none'}); }); $('#flap').mouseenter(function() { $('#scrotfloatMenu').css('z-index', '1'); $('#specflap').css('z-index', '1'); $('#floatMenu').css('z-index', '2'); $('#scrotfloatMenu').animate({ top : "-104px" }, 200, function() { $('#scrotflap').html("I  Bilder"); }); $('#floatMenu').animate({ top : "-20px" }, 500, function() { $('#flap').html(":  Schließen"); }); }); $('#flaphw').mouseenter(function() { $('#scrotfloatMenu').css('z-index', '1'); $('#specflap').css('z-index', '1'); $('#floatMenuhw').css('z-index', '2'); $('#scrotfloatMenu').animate({ top : "-104px" }, 200, function() { $('#scrotflap').html("I  Bilder"); }); $('#floatMenuhw').animate({ top : "-20px" }, 500, function() { $('#flaphw').html(":  Schließen"); }); }); $('#flap').click(function() { $('#floatMenu').css('z-index', '1'); $('#floatMenu').animate({ top : "-256px" }, 200, function() { $('#flap').html("p  Quicklinks"); }); }); $('#floatMenu').mouseleave(function() { $('#floatMenu').css('z-index', '1'); $('#specflap').css('z-index', '3'); $('#floatMenu').animate({ top : "-256px" }, 200, function() { $('#flap').html("p  Quicklinks"); }); }); $('#flaphw').click(function() { $('#floatMenuhw').css('z-index', '1'); $('#specflap').css('z-index', '3'); $('#floatMenuhw').animate({ top : "-256px" }, 200, function() { $('#flaphw').html("p  Quicklinks"); }); }); $('#floatMenuhw').mouseleave(function() { $('#floatMenuhw').css('z-index', '1'); $('#specflap').css('z-index', '3'); $('#floatMenuhw').animate({ top : "-256px" }, 200, function() { $('#flaphw').html("p  Quicklinks"); }); }); $('#scrotflap').mouseenter(function() { $('#floatMenu').css('z-index', '1'); $('#specflap').css('z-index', '1'); $('#scrotfloatMenu').css('z-index', '2'); $('#floatMenu').animate({ top : "-256px" }, 200, function() { $('#flap').html("p  Quicklinks"); }); $('#scrotfloatMenu').animate({ top : "-20px" }, 500, function() { $('#scrotflap').html(":  Schließen"); }); }); $('#scrotflap').click(function() { $('#specflap').css('z-index', '3'); $('#scrotfloatMenu').animate({ top : "-104px" }, 200, function() { $('#scrotflap').html("I Bilder"); }); }); $('#scrotfloatMenu').mouseleave(function() { $('#specflap').css('z-index', '3'); $('#scrotfloatMenu').animate({ top : "-104px" }, 200, function() { $('#scrotflap').html("I Bilder"); }); }); $("#footer").hover(function() { $("#footer").stop().animate( { width: "320px", height: "98px" }); }, function() { $("#footer").stop().animate( { width: "190px", height: "29px" }); } ); $("#footer3").hover(function() { $("#footer3").stop().animate( { width: "320px", height: "98px" }); }, function() { $("#footer3").stop().animate( { width: "140px", height: "29px" }); } ); $('#footer4').hover(function() { $('#footer4').css('z-index' , '102') $('#flap4').css( {backgroundPosition: "top right"} ) $('#footer4').stop().animate( { marginBottom: "-5px", marginLeft: "50px" }); }, function() { $('#footer4').css( "z-index" , '100' ) $("#footer4").stop().animate( { marginBottom: "-74px", marginLeft: "-110px" }); $('#flap4').css( {backgroundPosition: "bottom right"} ) } ); $('#footer5').hover(function() { $('#footer5').css('z-index' , '102') $('#flap5').css( {backgroundPosition: "top right"} ) $('#footer5').stop().animate( { marginBottom: "-18px", marginLeft: "80px" }); }, function() { $('#footer5').css( "z-index" , '99' ) $('#footer5').stop().animate( { marginBottom: "-74px", marginLeft: "-40px" }); $('#flap5').css( {backgroundPosition: "bottom right"} ) } ); $('.attention') .mouseover(function(){ $('#hlogin').fadeIn(); }) $('#hlogin') .mouseleave(function(){ $('#hlogin').fadeOut(); }) xwert = ($(window).width() - 982) / 2; xwertbox = ($(window).width() - 522) / 2; xwertbox = xwertbox + 522; $('#hlogin').css('left' , xwertbox ); $(window).resize(function () { xwert = ($(window).width() - 982) / 2; xwertbox = ($(window).width() - 522) / 2; xwertbox = xwertbox + 522; $('#hlogin').css('left' , xwertbox ); }); $('#zeiterfassung') .css( {backgroundPosition: "0px 0px"} ) .mouseover(function(){ $(this).stop().animate({backgroundPosition:"8px -99px"}, {duration:300}) }) .mouseout(function(){ $(this).stop().animate({backgroundPosition:"0px 0px"}, {duration:200, complete:function(){ $(this).css({backgroundPosition: "0px 0px"}) }}) }) $('#zutrittskontrolle') .css( {backgroundPosition: "0px 0px"} ) .mouseover(function(){ $(this).stop().animate({backgroundPosition:"8px -99px"}, {duration:300}) }) .mouseout(function(){ $(this).stop().animate({backgroundPosition:"0px 0px"}, {duration:200, complete:function(){ $(this).css({backgroundPosition: "0px 0px"}) }}) }) $('#projektzeiterfassung') .css( {backgroundPosition: "0px 0px"} ) .mouseover(function(){ $(this).stop().animate({backgroundPosition:"8px -99px"}, {duration:300}) }) .mouseout(function(){ $(this).stop().animate({backgroundPosition:"0px 0px"}, {duration:200, complete:function(){ $(this).css({backgroundPosition: "0px 0px"}) }}) }) var speed = 8000; //speed bilderslide $('#mask-gallery, #gallery li').width($('#slider').width()); $('#gallery').width($('#slider').width() * $('#gallery li').length); $('#mask-gallery, #gallery li, #mask-excerpt, #excerpt li').height($('#slider').height()); var run = setInterval('newsscoller(0)', speed); //time bilderslide $('#gallery li:first, #excerpt li:first').addClass('selected'); //Pause the slidershow with clearInterval $('#btn-pause').click(function () { clearInterval(run); return false; }); //Continue the slideshow with setInterval $('#btn-play').click(function () { run = setInterval('newsscoller(0)', speed); return false; }); //Next Slide by calling the function $('#btn-next').click(function () { newsscoller(0); return false; }); //Previous slide by passing prev=1 $('#btn-prev').click(function () { newsscoller(1); return false; }); //Mouse over, pause it, on mouse out, resume the slider show $('#slider').hover( function() { clearInterval(run); }, function() { run = setInterval('newsscoller(0)', speed); } ); });