views:

133

answers:

1

I have a Galleriffic slideshow on my page. Right now the "large" image links to the next image in the slideshow. How can I make it link to an external file instead?

Thanks in advance

A: 

First, you have to add a hidden div or span tag to your unordered list:

<li>
  <a class="thumb" href="/imageurl/image.gif">imageititle</a>
  <span id="project-path" style="display:none;">example_path</span>
</li>

Then, add this code to your galleriffic.js file. You are grabbing the path from the span element:

addImage: function(listItem, thumbExists, insert, position) {
                    var $li = ( typeof listItem === "string" ) ? $(listItem) : listItem;                
                    var $aThumb = $li.find('a.thumb');
                **  var $path = $li.find('#project-path');
                **  var projectPath = $path.text();
                    var slideUrl = $aThumb.attr('href');
                    var title = $aThumb.attr('title');
                    var $caption = $li.find('.caption').remove();
                    var hash = $aThumb.attr('name');

Then, you add the value to the image variable:

            var imageData = {
        **      projectPath:projectPath,
                title:title,
                slideUrl:slideUrl,
                caption:$caption,
                hash:hash,
                gallery:this,
                index:position
            };

Now tell the gallery to change the link w/ new path on the full-size gallery images:

            // Construct new hidden span for the image
            var newSlide = this.$imageContainer
                .append('<span class="image-wrapper current"><a class="advance-link" rel="history" href="/project/'+imageData.projectPath+'" title="'+imageData.title+'">&nbsp;</a></span>')
                .find('span.current').css('opacity', '0');

And comment out the gallery click action here, so that your user can just use the normal link wrapping the image:

                        newSlide.find('a')
                .append(imageData.image)
                //.click(function(e) {
                    //gallery.clickHandler(e, this);
                //})
                ;
wrburgess
Thank you so much, I will try this and let you know how I got on.