Last active
January 14, 2016 02:35
-
-
Save jafow/13bb3c1e94a0c38eeaf2 to your computer and use it in GitHub Desktop.
placing an avatar and image feed
This file contains 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
$( document ).ready( function () { | |
$.getJSON("#dataobject", (data) => { | |
let imgArray = matchElements(data)(/(?:scontent)/); | |
//place and style the user avatar thumbnail | |
placeAvatar(".img-thumbnail", imgArray[0]); | |
//display the user's feed | |
$( ".img-display" ).html("<img src='" + imgArray[1] + "'/>"); | |
}); | |
}); | |
}); | |
//Places and styles the user avatar; | |
const placeAvatar = (selector, src) => { | |
$(selector).attr("src", src).css({height: "28px", width: "28px"}); | |
//IG doesn't style the border radius of the <img> itself. Rather they style the parent <a> tag border radius. | |
$( ".avatar" ).css({borderTopLeftRadius: "50%", borderTopRightRadius: "50%"}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment