开发者

jQuery bouncing image

开发者 https://www.devze.com 2023-03-05 22:47 出处:网络
I have a requirement, wherein, the client want\'s an image to bounce, currently I\'m using this $(window).ready(function () {

I have a requirement, wherein, the client want's an image to bounce, currently I'm using this

$(window).ready(function () {
           $('#homePageImage').stop()
       开发者_运维百科    .animate(
            {
                 height: '370px'
            },
            {    queue: false,
                 duration: 1000,
                 easing: 'easeOutBounce' });
             });

But, the client wants the entire image to "fall down" and bounce, how can it be done?

Thank you !


I'm not sure what you're asking mate really...

here are two potential solutions:

  1. Include Jquery ui - easeOutBounce is a jquery ui component and not included in stock jquery.

  2. Make #homePageImage position: absolute and animate the top: value not the height:. That way the image will fall down and bounce. You'll have to start with the image at top: -*height of the image* so its just off the screen and then animate it to top: *where you want it* with the easing easeOutBounce. :)

0

精彩评论

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