开发者

Replacing the title attribute in imgbox

Using the most recent build of imgbox, encountering the same problem I had with LightBox2; mainly, the 'title' attribute. It makes a caption, but html likes to make a hovertext over the image link.

Like so:

  <a id="example1-1" href="./painting/everythingieverwanted/everythingieverwanted.jpg" title="Lorem <a href=''> ipsum</a> dolor sit amet">
开发者_如何转开发

I went in and tried to manually switch all instances of 'title' in jquery.imgbox.js to 'imagecaption', and renamed my attributes accordingly, so:

  <a id="example1-1" href="./painting/everythingieverwanted/everythingieverwanted.jpg" imagecaption="Lorem <a href=''> ipsum</a> dolor sit amet">

but that didn't work. Any idea where I am going wrong?


So the reason you're getting hell is because your tags are CRAZY malformed:

<a id="example1-1" href="./painting/everythingieverwanted/everythingieverwanted.jpg" imagecaption="Lorem <a href=''>

should be

<a id="example1-1" href="./painting/everythingieverwanted/everythingieverwanted.jpg" imagecaption="Lorem Ipsum">

You should not have any HTML in the value you're setting for the caption. It just turns out bad. Also, you cannot nest <a> tags. Browsers freak out badly when you do.

If you just want to store a value with the link, use the HTML5 data attributes:

<a id="example1-1" href="./painting/everythingieverwanted/everythingieverwanted.jpg" data-caption="Lorem Ipsum">


I looks like imgBox comes with a second .jss file that needs to be altered that I didn't notice at first: jquery.imgbox.pack.js

Basically I went through and replaced all "title" attributes with "imgboxcaption" in both

jquery.imgbox.pack.js and jquery.imgbox.js and imgbox.css

then, when writing it out, this works:

<a id="popup" href="./painting/everythingieverwanted/everythingieverwanted.jpg" imgboxcaption="Lorem <a href=''>Ipsum</a>"><img src="./painting/everythingieverwanted/redsuitBOX.jpg" /></a>

No html hover because of the title tag, and the caption is there.

Note that the titleh attribute does not need to be changed.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜