0

我正在使用 jquery 循环,这是我的代码:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
pre { display:none }
#main h2 { text-align: center }
#right { cursor: pointer }
#twitter-widget { width: 300px; float: right; margin-left: 20px; height: 200px; }
.twitterSearchTitle { font-family: 'trebuchet ms' }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://malsup.github.com/jquery.cycle.all.js"></script>
<script type="text/javascript">

$(function() {
// run the code in the markup!
$('#demos pre code').each(function() {
    eval($(this).text());
});

});
</script>
</head>
<body>

<div id="main">

<div id="demos">
    <div id="two" class="pics">
        <img id="letter-i" src="02.jpg" width="300" height="330" />
        <img id="veggi2" src="05.jpg" width="300" height="330" />
    </div>

    <pre><code class="mix">$('#two').cycle({ 
                    fx:     'fade', 
                    speed:   300, 
                    timeout: 3000, 
                    pause:   1 
                    });
    </code></pre>
    </td><td>
</body>
</html>

我想要做的想法有点难以解释,以一种非常简单的方式,我希望我的图像以不同的间隔淡入和淡出。更准确地说,例如在我的代码中,考虑divid="two"希望第一张图像更快地更改为第二张图像,而第二张图像更慢地更改为第一张图像。

使用我的代码,图像以相同的速度淡入和淡出。我需要知道如何为每个图像设置不同的间隔。

The main idea is that certain groups of images appear together, So I want to synch the intervals some how that I have the following pattern 1-2-3 -> 1-4-3 -> 5-4-6 -> 1-4-3 -> 1-2-3 ->... (imagine that I have images 1,2,3,4,5,6, for example 1-2-3 shows that images 1 and 2 and 3 apear together, and -> shows the transition)

4

1 回答 1

0

I figured it out, instead of setting different intervals for each image I defined the groups of picture that I wanted to show together, then I set my cycles between these groups:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
pre { display:none }
#main h2 { text-align: center }
#right { cursor: pointer }
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://malsup.github.com/jquery.cycle.all.js"></script>
<script type="text/javascript">

$(function() {
// run the code in the markup!
$('#demos pre code').each(function() {
    eval($(this).text());
});

});
</script>
</head>
<body>

<div id="main">

<div id="demos">
 <div id="slider">

    <div id="bxo" class="pics">
        <img id="letter-b" src="01.jpg" width="300" height="330" />
        <img id="veggi1" src="02.jpg" width="300" height="330" />
        <img id="letter-o" src="03.jpg" width="300" height="330" />

    </div>
    <div id="bio" class="pics">
        <img id="letter-b" src="01.jpg" width="300" height="330" />
        <img id="letter-i" src="05.jpg" width="300" height="330" />
        <img id="letter-o" src="03.jpg" width="300" height="330" />
    </div>
    <div id="xix" class="pics">
        <img  id="veggi2" src="04.jpg" width="300" height="330" />
        <img id="letter-i" src="05.jpg" width="300" height="330" />
        <img  id="veggi3" src="06.jpg" width="300" height="330" />
    </div>
    <div id="bio" class="pics">
        <img id="letter-b" src="01.jpg" width="300" height="330" />
        <img id="letter-i" src="05.jpg" width="300" height="330" />
        <img id="letter-o" src="03.jpg" width="300" height="330" />
    </div>



       </div>
       <pre><code class="mix">$('#slider').cycle(
    { 
                    fx:     'fade', 
                    speed:   500, 
                    timeout: 3000, 
                    pause:   1 
                    });
                    </code></pre>
 </body>
 </html>
于 2012-05-31T12:19:44.210 回答