Home

webサイト構築メモ

wordpressテーマ変更

wordpressのテーマをXHTML1.0 Strict DTD準拠のwp.vicunaに変更しました。

wordpressのテーマ変更は非常に楽、かつ本テーマはデザインも素晴しい。

Lightbox2でareaタグにrel属性を使うとxhtml validにならない

Lightbox2はaタグだけではなく、areaタグにも使えるのですが、
aタグ同様rel属性値を”lightbox”としてしまうと、xhtml validにはなりません。

というわけで、回避手段としてrel属性の代わりに汎用属性であるlang属性を使うようLightbox2のソースコードを変更します。

あまりお勧めできる方法ではありませんので、ご参考程度にどうぞ。

以下はlightbox2.04のソースです。

・lightbox.js 191行目を変更

var target = event.findElement(’a[rel^=lightbox]‘) || event.findElement(’area[rel^=lightbox]‘);

var target = event.findElement(’a[rel^=lightbox]‘) || event.findElement(’area[lang^=lightbox]‘);

・lightbox.js 216 - 227行目を変更

if ((imageLink.rel == ‘lightbox’)){
// if image is NOT part of a set, add single image to imageArray
this.imageArray.push([imageLink.href, imageLink.title]);
} else {
// if image is part of a set..
this.imageArray =
$$(imageLink.tagName + ‘[href][rel="' + imageLink.rel + '"]‘).
collect(function(anchor){ return [anchor.href, anchor.title]; }).
uniq();

while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
}

if (imageLink.rel) {
if ((imageLink.rel == ‘lightbox’)){
// if image is NOT part of a set, add single image to imageArray
this.imageArray.push([imageLink.href, imageLink.title]);
} else {
// if image is part of a set..
this.imageArray =
$$(imageLink.tagName + ‘[href][rel="' + imageLink.rel + '"]‘).
collect(function(anchor){ return [anchor.href, anchor.title]; }).
uniq();

while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
}
} else if (imageLink.lang) {
if ((imageLink.lang == ‘lightbox’)){
// if image is NOT part of a set, add single image to imageArray
this.imageArray.push([imageLink.href, imageLink.title]);
} else {
// if image is part of a set..
this.imageArray =
$$(imageLink.tagName + ‘[href][lang="' + imageLink.lang + '"]‘).
collect(function(anchor){ return [anchor.href, anchor.title]; }).
uniq();

while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
}
}

属性値”lightbox[xxx]“の書式もvalidにならないので、

lang=”lightbox.xxx”とします。

Home

Search
Feeds
Meta

Return to page top