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
    Jul 2002
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Layer's problems

    I would like to know how I can make in Dreamweaver a layer to be fix in the page...not to change his position when I change the resolution of the computer ?

    And, how I can make a layer possible for me to move with the mouse...where I want into my web page?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hand code the following

    I think this would do what you want

    <div align="center" id="LayerName"
    style="HEIGHT: 100px; LEFT: 10px; POSITION: absolute; TOP: 140px; VISIBILITY: hidden; WIDTH: 100%; Z-INDEX: 3">

    Anyone feel free to correct me if I am wrong.

    As for moving a layer I'd need to have a think about that.

  • #3
    New Coder
    Join Date
    Jun 2002
    Location
    NYC
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Think javaScript when you want things to move around.

    You want a layer styled with position:absolute and whatever top and left values you wish to start with. You want to know when the mouse is inside the specified area with an onMouseOver() eventhandler. You want to capture the mouse's X and Y coordinates with an onMouseDown() event handler, and you want to capture the mouse's relative movement and transfer that to the left and top values of the layer. Note, you don't want to duplicate the mouse's coordinates, simply the relative change. Mouse moves 10 pixels to the top and 15 to the right, then the new values for the layer would be top=top-10; left = left+15. The specifics of the implementation would be determined by the design and what other layers are on your page. You might also want to change the z-index of the dragged layer to an arbitrarily large value to prevent it from being hidden behind other elements. This isn't a javascript forum, but there's a lot of overlap since your scripts are actually modifying the CSS settings of your layer.

    If you're using Dreamweaver, read up on the actions, or check the Macromedia site. This is the kind of basic function that would certainly be available.

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    <div style="position: fixed; left: 15px; bottom: 15px;">
    Content always in lower left corner
    </div>

    Of course, that only works in the most standard compliant browsers, such as NS6.1+ (any relatively recent Gecko build too), Opera 6, etc.

    Take a look at DynamicDrive for some always in one spot scripts.


  •  

    Posting Permissions

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