My task involves fetching image source from a JSON file and then displaying it on an HTML page.
https://i.sstatic.net/coOaU.png
I also need to overlay a Font Awesome icon on top of the image as shown below:
https://i.sstatic.net/nbrLk.png
https://i.sstatic.net/yYha7.png
However, when I tried to implement the code for this feature, I encountered an issue where the Font Awesome icon was not displaying properly.
html
<link
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"
rel="stylesheet" type='text/css' >
script
$(document).ready(function() {
var maskedImageUrla = "";
var fontawesome = "<i class='fa fa-user-plus fa-2x'></i>";
$.getJSON('test.json', function(json) {
if (tl.src)
{
maskedImageUrla = 'http://sitename.com/images/' + tl.src;
}
var mask1 = $(".container").mask({
maskImageUrl: maskedImageUrla,
fontawesome: fontawesome,
onMaskImageCreate: function(img) {}
});
}); // end of document ready
Here is json file
Here is https://codepen.io/kidsdial/pen/bZNNXJ
Update: Code Snippet has been added below...
Your updated JS code snippet here
Your updated CSS code snippet here
Your updated HTML code snippet here