Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to change Fancybox script for having a title and description
    primarykey
    data
    text
    <p>i have fancybox v. 2.1.5</p> <p>My script creates a title from <code>&lt;a title=""&gt;</code> and a description from <code>&lt;a alt=""&gt;</code>. But as "alt" is not a valid attribute for <code>&lt;a&gt;</code>, i would like to call the description or 1) from the <code>&lt;img alt=""&gt;</code> or a data-fancybox-desc or something like that from the <code>&lt;a&gt;</code>. I do not know anything about javascript and jQuery, can someone change my code for it ?</p> <p>The HTML which is ok if i want to use <code>&lt;img alt=""&gt;</code> for description :</p> <pre><code>&lt;div class="view view-add"&gt; &lt;a href="http://www.igorlaszlo.com/images/41.jpg" class="fancybox-thumbs" data-fancybox-group="group1" title="Dance in the Dark"&gt; &lt;img src="http://www.igorlaszlo.com/thumbs/41.jpg" alt="Model : Thierry Mercier" /&gt; &lt;div class="mask"&gt; &lt;h4&gt;Dance in the Dark&lt;/h4&gt; &lt;p&gt;Model : Thierry Mercier&lt;/p&gt; &lt;div class="info"&gt;Click for zoom&lt;/div&gt; &lt;/div&gt; &lt;/a&gt; &lt;/div&gt; </code></pre> <p>The script what should be changed:</p> <pre><code>&lt;script&gt; $(document).ready(function() { $(".fancybox-thumbs").fancybox({ padding: 0, openEffect : 'elastic', openSpeed : 150, closeEffect : 'elastic', closeSpeed : 150, closeClick : true, prevEffect : 'elastic', nextEffect : 'elastic', closeBtn : true, arrows : true, nextClick : true, beforeShow: function () { this.title = $(this.element).attr('title'); this.title = '&lt;h3&gt;' + this.title + '&lt;/h3&gt;' + $(this.element).attr('alt') + '&lt;br /&gt;'; afterShow: function() { }, helpers : { title : { type: 'inside' } } }); }); &lt;/script&gt; </code></pre> <p>Thanks in advance !</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload