Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(function($) {
- $(document).ready(function() {
- if ($('.dt-gallery').length) {
- $('.dt-gallery .et_pb_gallery_item a').each(function() {
- //Store the actual Title in a variable called title
- var title = $(this).attr('title');
- //remove the title attribute on the links - so no title will be shown on hover
- $(this).removeAttr('title');
- //set a custom data attribute containing the title - will be used in a custom call for of magnificPopup Library
- $(this).attr('data-title', title)
- });
- //Load a custom instance of magnificPopup Library to be able to set again the titles values - which were removed previously
- $('.dt-gallery .et_pb_gallery_item .et_pb_gallery_image').magnificPopup({
- type: 'image',
- delegate: 'a',
- gallery: {
- enabled: true
- },
- //Set the title for the images (when enlarged) by using the data-title attribute - which was set on line 12.
- image: {
- titleSrc: function (item) {
- return '<p class="gallery-image-title">' + item.el.data('title') +'</p>';
- }
- }
- });
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment