Created
April 3, 2013 16:59
-
-
Save cedricpinson/5303078 to your computer and use it in GitHub Desktop.
start stop example
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
var sketchfabModule = window['sketchfab-iframe']; | |
var moduleVersion = sketchfabModule.version; | |
var Sketchfab = sketchfabModule.Sketchfab; | |
var Q = sketchfabModule.Q; | |
// example with only start stop | |
var urlid = "z9Psf5XIvSeuJYiMnuBgeRjLwql"; | |
var iframeWindow = $('#myIframe')[0]; | |
var api = new Sketchfab(iframeWindow); | |
// bind button to start to load | |
$("#example-start").click(function() { | |
Q.when(api.load(urlid)).then(function(data) { | |
api.start(); | |
$("#example-status").text("scene loaded"); | |
}).fail( function(error) { | |
$("#example-status").text("error can't load scene"); | |
}); | |
}); | |
$("#example-stop").click(function() { | |
Q.when(api.stop()).then(function(data) { | |
$("#example-status").text("scene stopped"); | |
}).fail( function(error) { | |
$("#example-status").text("error stop scene"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment