Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(initImages);
- function initImages(){
- $(".img-wrapper").click(function(){
- $(this).find("img").remove();
- var id = $(this).attr("data-id");
- var framename = $(this).attr("data-name");
- $(this).append(generateIFrame(id, framename));
- });
- }
- function generateIFrame(id, framename) {
- return "<iframe src='' frameborder='1' style='margin-left: 2%; margin-top: 4%; width: 250px; height: 417px; position: absolute; z-index: 0' id='" + framename + "' allowfullscreen mozallowfullscreen='true' webkitallowfullscreen='true'></iframe><img src='../products/empty/empty.png' style='z-index: 0;'/><script type='text/javascript'>var iframe=document.getElementById( '"+framename+"' ); var version = '1.0.0';var sword = '" + id +"';var client=new Sketchfab( version, iframe );client.init(sword,{success:function onSuccess(api){api.start();api.addEventListener( 'viewerready',function(){console.log( 'Viewer is ready' );});},error: function onError(){console.log('Viewer error');}});<\/script>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement