How do jQuery Nivo Slider transitions work?

I am wondering how to create a jQuery Nivo Slider transition effect, rather than create an entire plugin. I tried playing with CSS clip, but I could not get it to create an effect when part of the image fades or leaves the block frame by frame until the next slide appears.

If someone has a general idea or specific code on how to make transition effects, it would be grateful.

+5
source share
2 answers

The general idea is as follows: You have a div with the first image, and then you have a large number of divs with the second image, you create them css property settings

div - , ,

, , . , , , -

Html :

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js" type="text/javascript"></script>
    <style type="text/css">
    .first{
        height:500px;
        width:500px;
        position: absolute;
        background:url(1.jpg);
        z-index: 2;

    }

    .second_part1{
        height:50px;
        width:50px;
        position: absolute;
        background:url(2.jpg) 0 0;
        z-index: 2;

    }

    .second_part2{
        height:50px;
        width:50px;
        position: absolute;
        background:url(2.jpg) -50px 0;
        left:50px;
        z-index: 2
    }

    .second_part3{
        height:50px;
        width:50px;
        position: absolute;
        background:url(2.jpg) -200px -150px ;
        left:200px;;
        top:150px;
        z-index: 2
    }
</style>
</head>
<body>
    <div class="first">
    </div>
    <div class="second_part1">
    </div>
    <div class="second_part2">
    </div>
    <div class="second_part3">
    </div>
</body>
</html>

div2, , . , .

javascript , ( div), , , .

, nivo - , :)

+6

Google, NivoSlider.

NivoSlider, div , URL- , , :

// Set the slices size
var slice_w = $slider.width() / config.slices,
    slice_h = $slider.height();

// Build the slices
for (var i = 0; i < config.slices; i++) {
    $('<div class="slice" />').css({
        'position':'absolute',
        'width':slice_w,
        'height':slice_h,
        'left':slice_w*i,
        'z-index':4,
        'background-color':'transparent',
        'background-repeat':'no-repeat',
        'background-position':'-' + slice_w*i + 'px 0'
    }).appendTo($slider);
}

// Change the background image when slideshow starts from here... etc etc...

, : http://reader-download.googlecode.com/svn/trunk/simple-useful-jquery-slideshow_nivo-slider-like-effect.html

+2

All Articles