开发者

Timed animation with jQuery

开发者 https://www.devze.com 2023-01-07 07:10 出处:网络
Is this possible via jQuery ? Basically as shown in above image , I have blue background , map image and text images. I want to achieve th开发者_如何转开发is kind of animation at the page load or w

Timed animation with jQuery

Is this possible via jQuery ? Basically as shown in above image , I have blue background , map image and text images. I want to achieve th开发者_如何转开发is kind of animation at the page load or whenver this image is loaded.


You'll want to use a combination of animate() and delay() to time each slide just right. Here's an example of what I recently put together using this.

http://www.panthersweat.com/thursday/


yes you can do it by mixing javscript and jquery... i have did something in a banner some time before..

the code follows

var timerCount = 1;
var timer = setInterval('sliderController()',5000);


function sliderController() {
    status = changeSlide(timerCount);
    if(status == 1) {
        timerCount++;
    }
    else{
        timerCount = 1;
    }
}

function changeSlide(timerCount)    {
    if(timerCount != 3) {
        leftValue = -1004 * timerCount;
        $('#banner_slider_container #banner_slides_container').stop().animate({'left':leftValue,'opacity':0.3},'slow',function()    {
            $('#banner_slider_container #banner_slides_container').animate({'opacity':1},'slow');
        });
        return 1;
    }
    else    {
        leftValue = 0;
        $('#banner_slider_container #banner_slides_container').stop().animate({'left':leftValue,'opacity':0.3},'slow',function()    {
            $('#banner_slider_container #banner_slides_container').animate({'opacity':1},'slow');
        });
        return 0;
    }

}

i think this will help you.......


Basically that's what jQuery's .animate() is for. You'll have to express every necessary animation state/step with CSS, but a simple animation like the one above shouldn't be a problem.

http://api.jquery.com/animate/


Since 1.4 jQuery has the .delay() function u can use in animations. Perhaps that's what you need?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号