I am using this code to place an image icon over a div. Whatever the position of the div, the image icon would be there as the image icon css position is governed by the div absolute position:
jQuery(document).ready( function( $ ) {
var divname1= '.mydiv';
var position = $(divname1).offset();
$('#myicons').css(position);
$(divname1).append('<div id="myicons"><a href="#"><img src="http://test.tld/wp-content/plugins/myplugin/resources/img/myicons.png"></a></div>');
});
It works perfectly except the problem is that it occupies space and distorted the existing div after appending to the div where it will be placed. I would like to float it over the target div (e.g. divname1) after appending so as not to alter the existing divname1 layout.
Do you have ideas?
Add this line of code check if this works.