WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ElectricFeet
    Member
    Posted 1 year 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
    Member
    Posted 9 months 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
    Member
    Posted 9 months 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
    Member
    Posted 9 months ago #

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

  5. ElectricFeet
    Member
    Posted 9 months 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
    			      $("a.grouped_elements").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'
    			      });
    				});
    			</script>

    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
    Member
    Posted 9 months ago #

    Worked perfectly, thank you so much.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic