Advertisement

Gallery 2011 -- "clickpicture" event - navigate - new page

Moderators: Calcifer, slothy

Gallery 2011 -- "clickpicture" event - navigate - new page

Postby Cafiend (Restore) » Wed Oct 12, 2011 3:23 pm

I love this gallery. It is working reat for me, except now I want to implement the "Use the "clickpicture" event to navigate to another page" portion of the code.

I am a novice at this. I don't know where on the page to place the code:

<div class="dg-image-gallery-image" id="product1">
<img class="dg-image-gallery-thumb" src="demo-images/thumb_1.gif">
<span class="dg-image-gallery-caption">Siberian Iris<span class="imgCopyright"><br>Image copyrights - <a href="http://www.scottpeckphoto.com">ScottPeckPhoto.com</a></span></span>
<span class="dg-image-gallery-large-image-path">demo-images/large1.jpg</span>
</div>

Nor do I know where to place the script:
<script type="text/javascript">
function pictureHandler(obj){
location.href = 'product.html?id=' + obj.id.replace(/[^0-9]/g,'')
}
var gallery = new DG.ImageGallery({
el : 'dg-image-gallery'
listeners : {
clickpicture : pictureHandler
}
});
</script>

Dreamweaver 4 chokes on the

listeners : {
clickpicture : pictureHandler,
}
line in the script.

Looking at other code you have, I have tried putting clickpicture in single quotes. That doesn't work.
I don't know how to fix this error.

Many Thanks,
Darrel
Cafiend (Restore)
 
Posts: 0
Joined: Thu Jan 01, 1970 1:00 am

Re: Gallery 2011 -- "clickpicture" event - navigate - new pa

Postby Cafiend (Restore) » Fri Oct 14, 2011 4:02 pm

Hi,
I found the problem in Dreamweaver.

In the code below, it was missing a comma after el : 'dg-image-gallery'. That fixed that error but still cannot get it to work.

When I run it live on my site, the large pic is not clickable. I must be missing some part of the code.
Where does it grab the href from?


<script type="text/javascript">
function pictureHandler(obj){
location.href = 'product.html?id=' + obj.id.replace(/[^0-9]/g,'')
}
var gallery = new DG.ImageGallery({
el : 'dg-image-gallery',
listeners : {
'clickpicture' : pictureHandler,
}
});
</script>

======

<div class="dg-image-gallery-image" id="product1">
<img class="dg-image-gallery-thumb" src="demo-images/thumb_1.gif">
<span class="dg-image-gallery-caption">Siberian Iris<span class="imgCopyright"><br>Image copyrights - <a href="http://www.scottpeckphoto.com">ScottPeckPhoto.com</a></span></span>
<span class="dg-image-gallery-large-image-path">demo-images/large1.jpg</span>
</div>

Thanks
Darrel
Cafiend (Restore)
 
Posts: 0
Joined: Thu Jan 01, 1970 1:00 am


Return to Gallery script questions

Who is online

Users browsing this forum: No registered users and 15 guests

cron