Skip to content

Instantly share code, notes, and snippets.

@LukeXF
Last active April 20, 2019 11:33
Show Gist options
  • Save LukeXF/9bbb282ffb3cb86f1cd51f4061c5e566 to your computer and use it in GitHub Desktop.
Save LukeXF/9bbb282ffb3cb86f1cd51f4061c5e566 to your computer and use it in GitHub Desktop.
SMB embed boats
console.log('test');
$( document ).ready(function() {
console.log('test2');
$.getJSON( "https://api.skippermyboat.com/listing/" + $(".smb-embed").attr('id'), function( data ) {
var items = [];
console.log(data.boat.basic);
var boat = data.boat;
var cdn = "https://cdn.skippermyboat.com/boat/";
var i = 0;
$.each( boat.media.photos, function( key, val ) {
if (i < 3) {
items.push( "<div class='img-border'><div style='background: url(" + cdn + val + ") center / cover'/></div>" );
i++;
}
});
console.log(items);
$(".smb-embed").html(
"<h3>" +boat.basic.name +"</h3>"
);
$( "<div/>", {
"class": "boat-images",
html: items.join( "" )
}).appendTo( ".smb-embed" );
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment