2011-04-26 89 views
1

我從JQuery有這個腳本。Jquery覆蓋從檢查php變量

<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 
    overlay.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> 

現在它通過我點擊一個圖像的作品。然後覆蓋層會顯示div中的內容。不過,我想單擊圖片,只需在PHP中使用overlay就可以得到if語句。任何想法...我不是很擅長js。

編輯:

是的即時通訊使用JQuery插件緩動。但是覆蓋的偉大工程......和覆蓋工作通過點擊圖片上的rel屬性這樣

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

但是我不想點擊我希望它自動出現的圖像。

+1

我想你正在使用一些jQuery插件提供實際的'.overlay'方法? – deceze 2011-04-26 02:20:41

+0

如果這是爲了調試目的,那麼也許你最好使用XDebug和/或FirePHP? – GordonM 2011-04-26 05:51:58

+0

是的即時通訊使用JQuery插件緩動。然而,覆蓋的作品很好......覆蓋的作品通過點擊一個IMG與像這樣的rel屬性 但是,我不想點擊我想讓它自動出現的圖像。 – 2011-04-26 12:09:12

回答

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