jQuery+lightbox で 画像群をグループ単位に拡大できるようにする

現在の jquery.lightbox-0.5.js では lightboxの対象の画像をグループ単位に拡大できない。
jquery.lightbox-0.5.js の78行目あたりの
} else {
// Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references
for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute(‘href’),jQueryMatchedObj[i].getAttribute(‘title’)));
}
}
を 以下のように変更する。
} else {
// Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references
for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
// settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute(‘href’),jQueryMatchedObj[i].getAttribute(‘title’)));
// グループ可のため ===========
if(jQueryMatchedObj[i].getAttribute(‘rel’)==objClicked.getAttribute(‘rel’)) {
settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute(‘href’),jQueryMatchedObj[i].getAttribute(‘title’)));
}
// =============================
}
}
そしてHTML側のHead部分に
$(document).ready(function() {
$(‘a[rel^=lightbox]’).lightBox();
});
を書き込む。
http://blog.g-fellows.com/web/109/ が参考になりました。多謝。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です