Position element through css

后端 未结 2 1177
北恋
北恋 2021-01-29 05:59

what part of my code is wrong I keep getting invalid argument

I want to position the div element outside the document window on the left.

jQuery(this).cs         


        
相关标签:
2条回答
  • 2021-01-29 06:17

    document is the HTMLDocument instance. It's not an HTMLElement instance so no CSS styles apply to it. Consequently you can't read any left style from it. You can try document.documentElement (or $('html')) to get the root element child of the document, but I'm not sure what use you think reading its left style will be. (In reality: you'll get nothing.)

    Are you really trying to position a div outside of the browser window? Obviously this cannot work; the whole idea of the window is that it constrains, clips and scrolls the document content inside it.

    If you wanted to display content outside of the current browser window you would have to window.open a pop-up at a position based on the current window's screen position (screenLeft/screen.left etc). But pop-ups have many serious usability drawbacks and browsers limit their use for this reason.

    0 讨论(0)
  • 2021-01-29 06:21

    Might want to tell "left" what measure your statement is in (px, %, etc)

    0 讨论(0)
提交回复
热议问题