English 中文(简体)
页: 1 变换
原标题:jQuery carousel transformation

我怎么能改变 j子,显示3x3平方米的图像而不是1x3的图像?

来源:

<- |image| |image| |image| ->

:

   |image| |image| |image|
<- |image| |image| |image| ->
   |image| |image| |image|

我的《来源法》就是这样:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

  <meta http-equiv="content-type" content="text/html; charset=utf-8" />

  <link rel="stylesheet" href="css/style.css" type="text/css" />

  <!--[if IE 6]>
  <link rel="stylesheet" type="text/css" href="css/ie6.css" />
  <![endif]-->

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>

<script type="text/javascript">

$.fn.infiniteCarousel = function () {

    function repeat(str, num) {
        return new Array( num + 1 ).join( str );
    }

    return this.each(function () {
        var $wrapper = $( > div , this).css( overflow ,  hidden ),
            $slider = $wrapper.find( > ul ),
            $items = $slider.find( > li ),
            $single = $items.filter( :first ),

            singleWidth = $single.outerWidth(), 
            visible = Math.ceil($wrapper.innerWidth() / singleWidth), // note: doesn t include padding or border
            currentPage = 1,
            pages = Math.ceil($items.length / visible);            


        // 1. Pad so that  visible  number will always be seen, otherwise create empty items
        if (($items.length % visible) != 0) {
            $slider.append(repeat( <li class="empty" /> , visible - ($items.length % visible)));
            $items = $slider.find( > li );
        }

        // 2. Top and tail the list with  visible  number of items, top has the last section, and tail has the first
        $items.filter( :first ).before($items.slice(- visible).clone().addClass( cloned ));
        $items.filter( :last ).after($items.slice(0, visible).clone().addClass( cloned ));
        $items = $slider.find( > li ); // reselect

        // 3. Set the left position to the first  real  item
        $wrapper.scrollLeft(singleWidth * visible);

        // 4. paging function
        function gotoPage(page) {
            var dir = page < currentPage ? -1 : 1,
                n = Math.abs(currentPage - page),
                left = singleWidth * dir * visible * n;

            $wrapper.filter( :not(:animated) ).animate({
                scrollLeft :  +=  + left
            }, 500, function () {
                if (page == 0) {
                    $wrapper.scrollLeft(singleWidth * visible * pages);
                    page = pages;
                } else if (page > pages) {
                    $wrapper.scrollLeft(singleWidth * visible);
                    // reset back to start position
                    page = 1;
                } 

                currentPage = page;
            });                

            return false;
        }

        $wrapper.after( <a class="arrow back">&lt;</a><a class="arrow forward">&gt;</a> );

        // 5. Bind to the forward and back buttons
        $( a.back , this).click(function () {
            return gotoPage(currentPage - 1);                
        });

        $( a.forward , this).click(function () {
            return gotoPage(currentPage + 1);
        });

        // create a public interface to move to a specific page
        $(this).bind( goto , function (event, page) {
            gotoPage(page);
        });
    });  
};

$(document).ready(function () {
  $( .infiniteCarousel ).infiniteCarousel();
});
</script>
</head>
<body>


        <div class="infiniteCarousel">
            <div class="wrapper">
                <ul>
                    <li><a href="images/pic1.png"><img src="images/pic1.png" /></a></li>
                    <li><a href="images/pic2.png"><img src="images/pic2.png" /></a></li>
                    <li><a href="images/pic3.png"><img src="images/pic3.png" /></a></li>
                    <li><a href="images/pic4.png"><img src="images/pic4.png" /></a></li>
                    <li><a href="images/pic5.png"><img src="images/pic5.png" /></a></li>
                    <li><a href="images/pic6.png"><img src="images/pic6.png" /></a></li>
                    <li><a href="images/pic7.png"><img src="images/pic7.png" /></a></li>
                    <li><a href="images/pic8.png"><img src="images/pic8.png" /></a></li>
                </ul>    
            </div>
        </div>



</body>
</html>

而且:

.infiniteCarousel{
position: relative;
float: right;
width: 501px;
margin: 193px 0 0 -2px;
z-index: 10000;
}
.infiniteCarousel .wrapper{
position: absolute;
top: 0;
min-height: 10em;
width: 395px;
margin: 0 40px;
overflow: auto;
}
.infiniteCarousel ul a img{border: none;}
.infiniteCarousel .wrapper ul{
position: absolute;
padding:0;
top: 0;
width: 9999px;
margin:0;
list-style-image:none; ist-style-position:outside; list-style-type:none;
}
.infiniteCarousel ul li{
display:block;
float:left;
padding: 10px 5px;
height: 124px;
width: 124px;
}
.infiniteCarousel ul li a img{display:block;}
.infiniteCarousel .arrow{
display: block;
height: 50px;
width: 50px;
background: url(../images/arrow.png) no-repeat 0 0;
text-indent: -999px;
position: absolute;
top: 33px;
cursor: pointer;
}
.infiniteCarousel .forward{background: url(../images/arrowright.png) no-repeat 0 0; right: 3px;}
.infiniteCarousel .back{background: url(../images/arrowleft.png) no-repeat 0 0; left: -12px;}
.infiniteCarousel .forward:hover{background: url(../images/arrowrighthover.png) no-repeat 0 0;}
.infiniteCarousel .back:hover{background: url(../images/arrowlefthover.png) no-repeat 0 0;}
最佳回答

如何在每三升之后进行清理:

    <div class="infiniteCarousel">
        <div class="wrapper">
            <ul>
                <li><a href="images/pic1.png"><img src="images/pic1.png" /></a></li>
                <li><a href="images/pic2.png"><img src="images/pic2.png" /></a></li>
                <li><a href="images/pic3.png"><img src="images/pic3.png" /></a></li>
                <br class="clear" />
                <li><a href="images/pic4.png"><img src="images/pic4.png" /></a></li>
                <li><a href="images/pic5.png"><img src="images/pic5.png" /></a></li>
                <li><a href="images/pic6.png"><img src="images/pic6.png" /></a></li>
                <br class="clear" />
                <li><a href="images/pic7.png"><img src="images/pic7.png" /></a></li>
                <li><a href="images/pic8.png"><img src="images/pic8.png" /></a></li>
            </ul>    
        </div>
    </div>

上文的添加通知; 缩略语 班级:

.clear{
  clear:both;
}
问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签