Skip to content

Instantly share code, notes, and snippets.

@thecatishappy
Last active August 29, 2015 14:10
Show Gist options
  • Save thecatishappy/17d205077acff451d9a1 to your computer and use it in GitHub Desktop.
Save thecatishappy/17d205077acff451d9a1 to your computer and use it in GitHub Desktop.
Skfb
/ upload slider.js on your server
/ add your urlid in var array
<!DOCTYPE html>
<html>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://d2f25wgezub9nf.cloudfront.net/api/sketchfab-viewer-1.0.0.js"></script>
<script src="slider.js"></script>
<div align="center">
<iframe id="api-frame" height="480" width="640"></iframe>
</div>
<div align="center">
<button onclick="next()">Next model</button>
<button onclick="previous()">Previous model</button>
</div>
</body>
</html>
var iframe = $( '#api-frame' )[ 0 ];
var version = '1.0.0';
var client = new Sketchfab( version, iframe );
var index = 0;
var array = ["urlid1","urlid2","urlid3","urlid4",];
client.init(array[index]);
function next() {
index++;
if(index >= array.length) {
index = 0;
}
client.init(array[index]);
}
function previous() {
index--;
if(index < 0 ) {
index = array.length-1;
}
client.init(array[index]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment