我有一个jQuery脚本,在div中垂直和水平居中放置图像。这对于加载到Pikachoose滑块中的第一个图像非常有效,但是当Pikachoose更改幻灯片时,我需要脚本重新初始化-使下一个图像垂直和水平居中。
以下是在图像上工作的垂直/中心脚本:
$(window).load(function(){
var $img = $('img.galleryfull');
var h = $img.height();
$img.css('margin-top', +h / -2 + "px");
var w = $img
<script type="text/javascript">
(function($){
$(window).load(function(){
if(jQuery.isFunction(jQuery.fn.prettyPhoto)) {
$.prettyPhoto.open(
"images/ad1.jpg", // Image to be opened
"title", // Title of the po