我需要添加两个不同的标题来自定义其中的每一个在Nivo中
示例:
http://prntscr.com/23o766
但是看起来是不可能的,有没有办法在一个图片上放两个标题呢?
还是为了解决这个问题?此外,我希望能够使用标题作为一个链接,但有很多限制。谢谢。
代码:
<a class="image image-full" data-lightbox-gallery="gallery1" href="nivo-lightbox/img/b/grey_antique_q_white_mortar_concave_finish_technique_view_b.jpg" title="Grey Antique Q White Mortar Concave Finish Technique View B">
<img id="sample_board_image" src="nivo-lightbox/img/s/grey_antique_q_white_mortar_concave_finish_technique_view_b.jpg" alt="Grey Antique Q White Mortar Concave Finish Technique View B"></img>
</a>必须有一种方法可以在标题中添加多个样式,或者以任何其他方式在Lightbox的覆盖层中添加该文本。
实际上,我已经尝试过在nivo lightbox上插入另一个html,但是它给我带来了很多麻烦,内容显示不正确,有什么方法可以让内容适合到光明盒吗?
http://prntscr.com/23qm97
发布于 2013-11-12 17:10:15
是的,您可以通过为nivo滑块的图像的title属性指定一个元素id,以及为nivo的链接的href属性指定一个元素id。元素id应该指向一个具有您希望的任何内容的元素。
nivo照明盒
在nivo中,可以使用id元素作为href属性的值来显示html内容。因此,为了显示带有标题的图像,在下面的示例中,图像和标题应该是目标元素#test的html内容的一部分。
<a href="#test" class="image image-full" data-lightbox-gallery="gallery1" href="nivo-lightbox/img/b/grey_antique_q_white_mortar_concave_finish_technique_view_b.jpg" title="Grey Antique Q White Mortar Concave Finish Technique View B">
<img id="sample_board_image" src="nivo-lightbox/img/s/grey_antique_q_white_mortar_concave_finish_technique_view_b.jpg" alt="Grey Antique Q White Mortar Concave Finish Technique View B"></img>
</a>
<div id="test" style="display:none">this is from test
<img id="sample_board_image" src="nivo-lightbox/img/s/grey_antique_q_white_mortar_concave_finish_technique_view_b.jpg" alt="Grey Antique Q White Mortar Concave Finish Technique View B"></img>
<p>some content</p>
<p>a second <a href=#>title</a> as link</p>
</div>nivo滑块
例如,从nivo滑块jquery插件的演示代码中略作修改的摘录,
<div id="wrapper">
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<img src="images/walle.jpg" data-thumb="images/walle.jpg" alt="" data-transition="slideInLeft" />
<img src="images/nemo.jpg" data-thumb="images/nemo.jpg" alt="" title="#htmlcaption" />
</div>
<div id="htmlcaption" class="nivo-html-caption">
<strong>This</strong> is an example of a <em>HTML</em> caption with <a href="#">a link</a>. <br/>
<b>and another title!!!!</b>
</div>
</div>
</div>因此,您可以向元素中添加任何html内容和类值,以便根据需要修改标题。
编辑
为了响应最新的评论,为了使nivo能够在lightbox和屏幕分辨率中匹配html内容的图像,您需要指定属性height="100%"和width="100%"。下面是一个很粗略的例子,
http://jsfiddle.net/45nAc/show/
第一个图像是从html生成的。
<p><a href="#test" data-lightbox-gallery="gallery1"><img alt="" src="http://farm6.staticflickr.com/5471/9036958611_fa1bb7f827_s.jpg"></a> <a title="Calm Before The Storm (One Shoe Photography Ltd.)" href="http://farm4.staticflickr.com/3824/9041440555_2175b32078_b.jpg" data-lightbox-gallery="gallery1"><img alt="" src="http://farm4.staticflickr.com/3824/9041440555_2175b32078_s.jpg"></a> <a title="Lambs Valley (JMImagesonline.com)" href="http://farm3.staticflickr.com/2870/8985207189_01ea27882d_b.jpg" data-lightbox-gallery="gallery1"><img alt="" src="http://farm3.staticflickr.com/2870/8985207189_01ea27882d_s.jpg"></a> <a title="Grasmere Lake (Phil 'the link' Whittaker (gizto29))" href="http://farm4.staticflickr.com/3677/8962691008_7f489395c9_b.jpg" data-lightbox-gallery="gallery1"><img alt="" src="http://farm4.staticflickr.com/3677/8962691008_7f489395c9_s.jpg"></a></p>
<div id="test" style="display:none">
<img width="100%" height="100%" alt="" src="http://farm6.staticflickr.com/5471/9036958611_fa1bb7f827_b.jpg"/>
<div class="titles">
<p> this is a title1 <br/>
this is a <a href=#>title2</a>
</p>
</div>
</div>CSS
#test{
width:100%;
height:100%; /*background:url('http://farm6.staticflickr.com/5471/9036958611_fa1bb7f827_b.jpg');*/
}
#test .titles {
text-align:center;
}
.nivo-lightbox-theme-default .nivo-lightbox-ajax, .nivo-lightbox-theme-default .nivo-lightbox-inline{
margin:0 !important;
padding:0 !important;
top:0;
width:100%;
height:100%;
background-color:transparent;
box-shadow:none;
}准备好玩css,实现任何你需要的东西。
https://stackoverflow.com/questions/19934708
复制相似问题