开发者

Jquery overlay from checking php variable

I have this script from JQuery.

<script> 

// create custom animation algorithm for jQuery called "drop" 
$.easing.drop = function (x, t, b, c, d) {
    return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
};


// loading animation
$.tools.overlay.addEffect("drop", function(css, done) { 

   // use Overlay API to gain access to crucial elements
   var conf = this.getConf(),
       overlay = this.getOverlay();           

   // determine initial position for the overlay
   if (conf.fixed)  {
      css.position = 'fixed';
   } else {
      css.top += $(window).scrollTop();
      css.left += $(window).scrollLeft();
      css.position = 'absolute';
   } 

   // position the overlay and show it
   overlay.css(css).show();

   // begin animating with our custom easing
   over开发者_高级运维lay.animate({ top: '+=55',  opacity: 1,  width: '+=20'}, 400, 'drop', done);

   /* closing animation */
   }, function(done) {
      this.getOverlay().animate({top:'-=55', opacity:0, width:'-=20'}, 300, 'drop', function() {
         $(this).hide();
         done.call();      
      });
   }
);

$("img[rel]").overlay({
    effect: 'drop',
    mask: '#789'
});
</script> 

Right now it works by me clicking on an image. Then the overlay comes up with whatever is in the div. However I want to take out clicking the image and just have the overlay come up with an if statement in PHP. any ideas...im not very good at js.

EDIT:

yes im using the JQuery plugin Easing. However the overlay works great...and the overlay works by clicking on an image with the rel attribute like this

<img src="http://farm4.static.flickr.com/3651/3445879840_7ca4b491e9_m.jpg" rel="#mies1"/>

However I don't want to click on the images I want it to come up automatically.


<?php if ($whatever) { ?>
    $(document).ready(function() { 
         $("img[rel]").click();
    }); 
<?php } ?>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜