Last active
April 20, 2019 11:33
-
-
Save LukeXF/9bbb282ffb3cb86f1cd51f4061c5e566 to your computer and use it in GitHub Desktop.
SMB embed boats
This file contains hidden or 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
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