Results 1 to 5 of 5

Thread: Arggggh.... am I seeing things?!

  1. #1
    Join Date
    Feb 2007
    Location
    England
    Posts
    254
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Arggggh.... am I seeing things?!



    Here it is: I set the position of a div dynamically, it flips the directions.

    You would think it would be a case of swapping the co-ordinates assigned, but no.

    Does anyone know what I'm doing wrong?

    Code:
    var el = document.getElementById("startDiv");
    			if(debug){document.getElementById("debugText").value +="Start at"+el.style.left+","+el.style.top+"\n"}
    			el.style.top = parseInt(pos_f_y2*(this.tileSize+this.tileSpacing))+"px"
    			el.style.left = parseInt(pos_f_x2*(this.tileSize+this.tileSpacing))+"px"
    			if(debug){document.getElementById("debugText").value +="Start at"+el.style.left+","+el.style.top+"\n\n"}
    			//if(debug){document.getElementById("debugText").value +="Z:"+el.style.zIndex+"\n"}
    			this.startTileX = pos_f_x2;
    			this.startTileY = pos_f_y2;
    			return true;
    I've just added part of the code. If you need to see the whole thing, just ask, and I'll upload it.


  2. #2
    Join Date
    Feb 2007
    Location
    England
    Posts
    254
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default more...

    i add the div dynamically too with

    Code:
    if (document.getElementById && !document.all)
    				{
    				rng = document.createRange();
    				el = document.getElementById("mapDiv");
    				rng.setStartBefore(el);
    				htmlFrag = rng.createContextualFragment(temp_string);
    				while (el.hasChildNodes())
    				el.removeChild(el.lastChild);
    				el.appendChild(htmlFrag);
    				}
    Would that affect the divs ability to move correctly?

  3. #3
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hey bob90 , please tell me what you want as I am confused, if you want me to make what you tell me to just say the word....

  4. #4
    Join Date
    Feb 2007
    Location
    England
    Posts
    254
    Thanks
    0
    Thanked 5 Times in 5 Posts

    Default Don't worry.

    I will try to sort it tonight.

    I get an element, change its top and left position and it doesn't work.
    They get flipped for some reason.
    I can see this with the debug code and the div onscreen.

  5. #5
    Join Date
    Feb 2007
    Posts
    601
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •