If you would like to integrate a Facebook 'Like' button for individual images within a SimpleViewer-Pro gallery, you could try the following:
(1) Use the <iframe> implementation of the Facebook 'Like' button.
(2) Place the button on your gallery's HTML index page (not in the captions for each image). (See the '#overlay' <div> in my code below.)
(3) Use the SimpleViewer-Pro API to enable Direct Linking to individual images within the gallery.
(4) Use the SimpleViewer-Pro API (specifically the svImageChange() event) to change the 'src' attribure of the <iframe> (which is essentially the URL for the Facebook 'Like' button) each time the user selects a different image.
Try using the following as your gallery's 'index.html' file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="svcore/js/simpleviewer.js"></script>
<script type="text/javascript" src="swfaddress.js"></script>
<script type="text/javascript">
var svAPI;
function svComplete() {
svAPI = document.getElementById('svInstance');
};
function svImageChange(index) {
document.location = "#" + (index + 1);
var original = document.getElementById("fb").src;
var modified = original.replace(/\?href=(.*?)&/, "?href=" + encodeURIComponent(document.location) +"&");
document.getElementById("fb").src = modified;
}
SWFAddress.onChange = function() {
if(svAPI != null && svAPI.getImageIndex() != getLocationIndex()) {
svAPI.showImage(getLocationIndex());
}
}
function getLocationIndex() {
return location.hash.substr(1) - 1;
}
var flashvars = {};
flashvars.enableAPI = true;
flashvars.firstImageIndex = getLocationIndex();
var attributes = {};
attributes.id = "svInstance";
attributes.name = "svInstance";
simpleviewer.ready(function() {
svAPI = simpleviewer.load('sv-container', '100%', '100%', 'transparent', true, flashvars, null, attributes);
});
</script>
<title>SimpleViewer-Pro Gallery</title>
</head>
<body>
<div id="overlay" style="position: absolute; top: 50px; left: 10px; z-index: 999;">
<iframe id="fb" src="//www.facebook.com/plugins/like.php?href=#&send=false&layout=standard&width=450&show_faces=false&action=like&colorscheme=light&font&height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:35px;" allowTransparency="true"></iframe>
</div>
<div id="sv-container"></div>
</body>
</html>
Please note that you will also need to include the file 'swfobject.js' (which is required to fully support Direct Linking and Back Button support) in your gallery folder. The file can be downloaded from this web page.
Steven Speirs
SimpleViewer Support Team