I have some HTML that has an image tag and a bit of jQuery like this:
<body>
<img id="MainImage" src="../img/MainImage.png" style="position: absolute;">
<script type="text/javascript">
$(document).ready(function() {
var $img = $("#MainImage");
$img.hide();
$('div').mousemove(function(e) {
if ($(this).attr('align') === 'center') {
// only show if the align attribute has value center
$img.fadeIn(0);
$img.offset({
top: e.pageY - $img.outerHeight()-2,
left: e.pageX - ($img.outerWidth()-18)
});
}
}).mouseleave(function() {
$img.fadeOut(250);
});
</script>
</body>
I also have this manifest file with the following code:
{
"name": "Div Image Test",
"version": "1.0",
"manifest_version": 2,
"permissions": [
"tabs", "http://*/*"
],
"content_scripts": [{
"matches": ["http://*/*"],
"js": ["js/CoreTest.html"],
"run_at": "document_end"
}]
}
What this script/extension is for is, whenever the user hovers over any div (with the HTML attribute "align='center'"), an image pops up next to the mouse cursor... This already works but what I need to do is insert the script/HTML file into the "body" tags of every web page out there when the extension is installed.
How can I achieve this?
Thanks in advance.