获取轮播滑块中的第二张图片 JQuery

Get the second image in the carousel slider JQuery

我正在使用 http://web.enavu.com/demos/carousel.html 的轮播。我希望第一个左边的图像不透明度:1,其余不透明度:0.5。 :)

有人可以帮忙吗?

谢谢。

<script type="text/javascript">
$(document).ready(function() {
    //move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
    $('#carousel_ul li:first').before($('#carousel_ul li:last')); 


    //when user clicks the image for sliding right        
    $('#right_scroll img').click(function(){

        //get the width of the items ( i like making the jquery part dynamic, so if you change the width in the css you won't have o change it here too ) '
        var item_width = $('#carousel_ul li').outerWidth() + 10;

        //calculae the new left indent of the unordered list
        var left_indent = parseInt($('#carousel_ul').css('left')) - item_width;

        //make the sliding effect using jquery's animate function '
        $('#carousel_ul:not(:animated)').animate({'left' : left_indent},500,function(){    

            //get the first list item and put it after the last list item (that's how the infinite effects is made) '
            $('#carousel_ul li:last').after($('#carousel_ul li:first')); 

            //and get the left indent to the default -210px
            $('#carousel_ul').css({'left' : '-210px'});
        }); 
    });

  });
 </script>

 <div id='carousel_container'>
<div id='carousel_inner'>
    <ul id='carousel_ul'>
        <li><a href='#'><img src='item1.png' /></a></li>
        <li><a href='#'><img src='item2.png' /></a></li>
        <li><a href='#'><img src='item3.png' /></a></li>
        <li><a href='#'><img src='item4.png' /></a></li>
        <li><a href='#'><img src='item5.png' /></a></li>
    </ul>
</div>

在jquery中,用

抓住中心项目
var middle = $('li').get(2);

这将始终 return 中心项目。就在这个查询之后 运行

$(middle).css('opacity, .2'); // adjust the translucency of the image

onclick="changeMiddle()"添加到每个箭头按钮以触发此功能:

function changeMiddle()
{
    var middle = $('li').get(2); // fetch middle image
    $('li').css('opacity', '1');  // correct previous transparencies
    $(middle).css('opacity', '.2');   // make middle image transparent
}