The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Show image title in fancybox galleries, not page title? (6 posts)

  1. ElectricFeet
    Posted 3 years ago #

    The parameters passed to fancybox (the gallery/popup image viewer) currently make it show the page's title for each image. Could this be changed so that each image shows its own alt or title?

    In the meantime, anyone know how to modify the code to make this happen?

  2. shilogh55
    Posted 2 years ago #

    Did you manage to find an answer. I am trying to do the same. The code posted on themesandco did not work for me.

  3. ElectricFeet
    Posted 2 years ago #

    Yes, I did, but I'm not able to access my notes on how I did it for another week. Check back here in a week (unless of course someone else knows, or can see how I did it on http://darioalfonsi.com ).

  4. shilogh55
    Posted 2 years ago #

    Thanks, I will wait until you can access your notes. Looks good on your site, thats what I need.

  5. ElectricFeet
    Posted 2 years ago #

    OK, I'm back now.

    From what I can see, I edited class-fire-ressources.php
    and changed the fancybox stuff to:

    <script type="text/javascript">
    				jQuery(document).ready(function( $) {
    			      // Fancybox
    			        'transitionIn'  : 'elastic' ,
    			        'transitionOut' : 'elastic' ,
    			        'speedIn'   : 200,
    			        'speedOut'    : 200,
    			        'overlayShow' : true,
    			        'hideOnOverlayClick' : true,
    			        'autoScale' : <?php echo ($autoscale == 1) ? 'true' : 'false' ?>,
    			        'changeFade' : 'fast',
    			        'enableEscapeButton' : true,
    			        'overlayOpacity' : '0.3',
    			        'onStart' : function(currentArray,currentIndex){
    			           var obj = currentArray[ currentIndex ];
    			           this.title = $(obj).find('img').attr("alt");
    			        'titleFromAlt' : true,
    			        'titlePosition' : 'inside'

    One thing I found is that if you use captions that are long, they won't wrap in the black rounded boxes. You have to pull them inside the white frame to get them to wrap properly (hence the 'titlePosition' : 'inside' line).

    Two other changes you may note in there are:
    'overlayShow' : true, , 'hideOnOverlayClick' : true, and 'overlayOpacity' : '0.3'. These enable the background ('overlay'), make it grey (0.3, on a scale of 0 to 1, if I recall correctly), and allow you to click on the background to close fancybox.

    Let me know if this works for you.

  6. shilogh55
    Posted 2 years ago #

    Worked perfectly, thank you so much.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic