According to your API, loadImage() "Clears the viewport and loads a zoomable image". When I try to use it as suggested it throws a 404 error. I have to do the .data('StarZoom') dance to get the instance because 'new StarZoom' fails with a different error:
*/
$(function(){
var options = {"image":"zoomify/images/Banyoles_Olympic_Hotel"};
David Johnson
/*
According to your API, loadImage() "Clears the viewport and loads a zoomable image". When I try to use it as suggested it throws a 404 error. I have to do the .data('StarZoom') dance to get the instance because 'new StarZoom' fails with a different error:
*/
$(function(){
var options = {"image":"zoomify/images/Banyoles_Olympic_Hotel"};
$('#viewport').StarZoom(options);
var myInstance = $('#viewport').data('StarZoom');
console.log(myInstance.getCanvas());
myInstance.apiTest(); // api is OK
myInstance.loadImage("zoomify/images/sample-image_jpg");
// with leading slash also fails: myInstance.loadImage("/zoomify/images/sample-image_jpg");
});
// The instance definitely exists and I can call other methods on it. console.log(myInstance.getCanvas()) output:
// [Log] <canvas style="left: 0px; top: 0px; position: absolute; opacity: 0;" width="510" height="382"> (starzoom_image.js, line 36)
// But still it fails with this error:
/*
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (2-2-2.jpg, line 0)
[Log] error loading image src
*/
// I am sure my path is fine. The following works no problem:
$(function(){
var options = {"image":"zoomify/images/sample-image_jpg"};
$('#viewport').StarZoom(options);
});