Ready to get started?Download WordPress


FancyBox for WordPress
Custom Expression and getTitle function (1 post)

  1. Russell Jamieson
    Posted 1 year ago #

    Please can you change the getTitle function so that it only applies to only one element rather all anchor elements with class fancybox.

    The idea of the custom thumbnails expression is surely to make sure that the function is only applied to the anchors selected by that expression.

    My suggestion is that getTitle is redefined as follows (I dont think it will break anything ;-):

    jQuery.fn.getTitle = function() {
            var title = jQuery(this).children("img") . attr("title");
            jQuery(this) . attr('title',title);

    With this approach I can use the image title attribute as a short title that appears when the user places the cursor over the image and use a long title in the anchor title that contains a title, description, links etc.

    I can then exclude my galleries from auto-lightboxing as follows:

    jQuery(thumbnails).not(".fancybox") . addClass("fancybox") . attr("rel","fancybox") . getTitle();

    In other words - the expression says "make all images a fancybox that aren't already a fancybox'

    Thanks in advance.


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by Russell Jamieson
  • This topic is not resolved
  • WordPress version: 3.4.2


No tags yet.