SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2008
    0 Post(s)
    0 Thread(s)

    Problem with moving layer(javascript)


    I have a problem with javascript in moving layer.The basic requirement is to create a moving layer,but the layer should be 100% visible on screen it will not hide when you move layer with mouse.Here I am attaching the file.

    If change the code in dd(e) function the layer is moving well,but it is moving out the screen.

    function dd(e){
    if (!ddEnabled) return; ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;

    return false;

    If I replace the function dd(e) in mlayer.html file the layer is visible completly(100% you con't hide the layer ) on the screen, but it is not moving properly.

    function dd(e){
    if (!ddEnabled) return;

    var Xposition = isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx;
    if(Xposition >= 0 && (Xposition+whichDog.offsetWidth) < document.body.clientWidth) Xposition;
    var Yposition = isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
    if(Yposition >= 0 && (Yposition+whichDog.offsetHeight) < document.body.clientHeight) Yposition;
    if((Xposition)==0 && (Yposition) == 0){ = 1; = 1;
    return false;

    Please let me know the solution for this.
    Attached Files Attached Files

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Christchurch, New Zealand
    104 Post(s)
    4 Thread(s) has a script for correctly determining the mouse coordinates that should help.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Posting Permissions

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