At the beginning of the new week, when I was sitting in front of my desk, I went to view some jQuery and HTML5 application plug-ins, today, let's take a look at a very cool jQuery/HTML5 image slider special effect. This plug-in features a good elastic menu on the image. When you move the mouse over the menu, a translucent image will pop up. Let's take a look.
Of course, we can't simply look at the effect, or simply analyze the source code.
First, use the simplest HTML code to construct the image slider frame with menus:
Web Print Logos Photos
The following is the CSS3 code, which is mainly used to render the left and right arrows and Image Shadow effects. Here we paste the core CSS code:
{:;:;:;:;:;:; }{:; }{:; }{:; }{:;:;:;:;:;:;:;:; }{:;:;:;:;:;:;:;:;:; }
The focus is on jQuery code. The following jQuery code implements the slider animation of the image and the elastic animation effect when the mouse slides over the menu:
$( sliderInterval = setInterval(7000'.nav-arrow').click(($().attr('id') == 'arrow-left''#dots li').click( thisIndex = $((thisIndex < $('#dots li.active' (thisIndex > $('#dots li.active''#dots li.active').removeClass('active').addClass('active' curIndex = $('#image-slider li.active-img'(curIndex == 0'#image-slider li:last-child').addClass('next-img'0'#image-slider li.active-img').removeClass('active-img').css('left', '-923px''#image-slider li.next-img').attr('class', 'active-img' nextIndex = $('#image-slider li.active-img''#dots li.active').removeClass('active''#dots li').eq(nextIndex).addClass('active''#image-slider li.active-img').prev().addClass('next-img'0'#image-slider li.active-img').removeClass('active-img').css('left', '-923px''#image-slider li.next-img').attr('class', 'active-img' nextIndex = $('#image-slider li.active-img''#dots li.active').removeClass('active''#dots li').eq(nextIndex).addClass('active' curIndex = $('#image-slider li.active-img'(curIndex == $('#image-slider li').length - 1'#image-slider li:first-child').addClass('next-img').css('left', 9230'#image-slider li.active-img').removeClass('active-img').css('left', '-923px''#image-slider li.next-img').attr('class', 'active-img' nextIndex = $('#image-slider li.active-img''#dots li.active').removeClass('active''#dots li').eq(nextIndex).addClass('active''#image-slider li.active-img').next().addClass('next-img').css('left', 9230'#image-slider li.active-img').removeClass('active-img').css('left', '-923px''#image-slider li.next-img').attr('class', 'active-img' nextIndex = $('#image-slider li.active-img''#dots li.active').removeClass('active''#dots li').eq(nextIndex).addClass('active''#image-slider li').eq(newIndex).addClass('next-img'0'#image-slider li.active-img').removeClass('active-img').css('left', '-923px''#image-slider li.next-img').attr('class', 'active-img''#image-slider li').eq(newIndex).addClass('next-img').css('left', 9230'#image-slider li.active-img').removeClass('active-img').css('left', '-923px''#image-slider li.next-img').attr('class', 'active-img'
Very concise JS Code.
Finally, we can only see the basic slider effect in IE6.7.8. The source code is attached.>