Welcome to Advanced Interactive Web Mapping, Programming, and Design, Class 5
This is a web page that can be viewed as slides.
→ to move forward
← to go back
Advanced Interactive Web Mapping, Programming, and Design
Class 5
functions
$('.button').click(function () {
// Update map SQL
});
function {name} ({parameters}) {
{code}
}
function {name} ({parameters}) {
{code}
}
function sayHi (name) {
console.log('Why hello, ' + name);
}
function multiply (a, b) {
return a * b;
}
functions give us a way to do repetitive things
functions can make your code more readable
let's clean this up with a function
jsbin
https://maps.googleapis.com/maps/api/streetview?size=600x300&location=46.414382,10.013988&heading=151.78&pitch=-0.76
https://maps.googleapis.com/maps/api/streetview?size=600x300&location=46.414382,10.013988&heading=151.78&pitch=-0.76
https://maps.googleapis.com/maps/api/streetview?size=600x300&location=46.414382,10.013988&heading=151.78&pitch=-0.76
Say you wanted to add a street view image based on a search result
How do you set an image's url?
How do you set an image's url with jQuery?
$('.streetview-image')
.attr('src', streetviewUrl)
sometimes APIs aren't totally public