Last active
February 22, 2017 21:49
-
-
Save nealpoole/4383033 to your computer and use it in GitHub Desktop.
Simple example code for displaying an Issuu widget with a thumbnail preview. Degrades gracefully if JS is not enabled.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="issuu-widget"> | |
</div> | |
<script type="text/javascript" src="/wp-includes/js/swfobject.js"></script> | |
<script type="text/javascript"> | |
function loadIssuuWidget(result) { | |
var doc = result.response.docs[0]; | |
var link = jQuery('<a />').attr({ | |
href: 'http://issuu.com/browndailyherald/docs/' + doc.docname, | |
}); | |
jQuery('<img id="issuu-thumbnail" />').attr({ | |
src: 'http://image.issuu.com/' + doc.documentId + '/jpg/page_1_thumb_large.jpg', | |
width: 300 | |
}).appendTo(link); | |
link.appendTo("#issuu-widget"); | |
jQuery("#issuu-thumbnail").on("click", function(e) { | |
e.preventDefault(); | |
var attributes = { | |
id: 'issuu-viewer' | |
}; | |
var params = { | |
allowfullscreen: 'true', | |
menu: 'false', | |
wmode: 'transparent' | |
}; | |
var flashvars = { | |
jsAPIClientDomain: 'www.browndailyherald.com', | |
mode: 'mini', | |
documentId: doc.documentId | |
}; | |
swfobject.embedSWF("http://static.issuu.com/webembed/viewers/style1/v2/IssuuReader.swf", "issuu-widget", "300", "300", "9.0.0","swfobject/expressInstall.swf", flashvars, params, attributes); | |
}); | |
} | |
</script> | |
<script type="text/javascript" src="http://search.issuu.com/api/2_0/document?username=browndailyherald&sortBy=epoch&pageSize=1&jsonCallback=loadIssuuWidget"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment