Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Location
    London
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Making images appear in Javascript either side of the cursor

    Hi Guys,

    I'm fairly new to Javascript and wondering if anyone can help? Depending on where the user's cursor is positioned on the web page, I need for two images to appear 10pixels either side of the cursor. I need for these images to appear on a keypress, and to disappear on a keypress too. Does anyone have any ideas for help? Would the code be something like window.event.src????

    Many thanks.

    This is how far I got so far!!

    function myfunction(e)
    {
    var keyChar = String.fromCharCode(window.event.keyCode);

    if (keyChar == 'N'||keyChar == 'n')
    {
    //output 2 images 10 pixels either side of the cursor (either on x or y axes)

    }

  • #2
    New to the CF scene
    Join Date
    Dec 2006
    Location
    London
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Ancora/Mike,

    Thanks so much for this script I was just trying to play around with it. I was just wondering if you could advise me?

    I need to tailor the script so that two images appear either side of the current mouse position (ideally a 10 pixels gap). Once the two images appear, they should stay in the same static position on the page. At the moment using the current script, the images move corresponding to the cursor location. Could you please let me know how to stop these from moving around?

    Thanks,
    Mike

  • #3
    Banned
    Join Date
    Oct 2005
    Location
    I'm in GMT -5
    Posts
    314
    Thanks
    0
    Thanked 1 Time in 1 Post
    Mike:

    Sorry, that's more than I'm willing to do. The code uses one div, nContainer, for the image, no matter what it is. A new container, well, TWO containers, would have to be created for each "item" you have onmouseover. And then, if that same "item" was hovered again... well, you get the point. It's just too much work.

  • #4
    New to the CF scene
    Join Date
    Dec 2006
    Location
    London
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Ancora/Mike,

    I completely understand - thanks a million for your help so far If I find the solution, I will let you know.

    Best wishes,
    Mike


  •  

    Posting Permissions

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