Skip to content

Instantly share code, notes, and snippets.

@cedricpinson
Created April 3, 2013 16:59
Show Gist options
  • Save cedricpinson/5303078 to your computer and use it in GitHub Desktop.
Save cedricpinson/5303078 to your computer and use it in GitHub Desktop.
start stop example
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