I am Jquery to generate the tags Dynamically on "click" events(Completely Client side). While creating it, one created is over lapping other how can i place it in a place where tag haven't created previosly? only in Jquery or javascript, and HTMl.
my code is below.,
var masterimageLeft = 0;
var masterimageTop = 0;
var masterClick = "";
var p = 0;
var imgid;
window.onload = centeronload;
function centeronload() {
$("#1").center();
}
function Showmenuonplus(e, id) {
imgid = id;
$("#mouse1").show();
masterimageLeft = e.pageX;
masterimageTop = e.pageY;
$("#mouse1").css({
position: "absolute",
top: e.pageY - 18,
left: e.pageX - 20
});
}
function getfbid(idd) {
return false;
}
function showmenu() {
$("#mouse1").show();
}
function hideonmouseout() {
$("#mouse1").hide();
}
jQuery.fn.center = function () {
this.css("position", "absolute");
this.css("top", Math.max(0, (($(window).height() - $(this).outerHeight()) / 2) + $(window).scrollTop()) + "px");
this.css("left", Math.max(0, (($(window).width() - $(this).outerWidth()) / 2) + $(window).scrollLeft()) + "px");
return this;
}
function click1(clicked_id) {
var fb_id = $("fb").attr("id");
masterClick = clicked_id;
if (masterClick == "parents" && imgid.title != "HaveParents") {
var lef = masterimageLeft - 340;
var top = masterimageTop - 190;
DynamicFb(lef, top);
var lef = masterimageLeft - 60;
var top = masterimageTop - 190;
DynamicFb(lef, top);
imgid.title = "HaveParents";
}
}
function DynamicFb(lef, top) {
var fb = document.createElement('fb');
var hdnvalue = document.getElementById('hdn').value;
fb.id = "fb" + hdnvalue;
fb.setAttribute("style", "left:" + lef + "px;top:" + top + "px;position:absolute");
document.getElementById('hdn').value = parseInt(hdnvalue) + 1;
document.getElementsByTagName('body')[0].appendChild(fb);
var a = "";
fb.innerHTML = a;
p++;
}
4 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.


VenkiPosted Feb 10, 2014, 1:56 AM
Jaganathan BantheswaranPosted Feb 10, 2014, 1:42 AM
VenkiPosted Feb 10, 2014, 12:04 AM
Jaganathan BantheswaranPosted Feb 7, 2014, 6:24 AM