TypeError: Argument 1 ('element') to Window.getComputedStyle must be an instance of Element
See original GitHub issueHi,
Im integrating view360 into my reactjs, but after adding the init code, iโm getting this error. TypeError: Argument 1 (โelementโ) to Window.getComputedStyle must be an instance of Element. I have already specified my height and width in the css file.
var container = document.getElementById("myPanoViewer");
var panoviewer = new PanoViewer(container, {
image: "public/images/bookcube2.jpg",
projectionType: "panorama"/* PanoViewer.PROJECTION_TYPE.PANORAMA */
});
return (
`div className = 'viewer' id="myPanoViewer"> </div>`
)
in css file
`.viewer {
position: relative;
width: 100%;
height: 100vh;
max-width: 800px;
margin: 0px auto;
overflow: hidden;
outline: none;
}`
Any idea whatโs going on?
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Argument 1 of Window.getComputedStyle does not implement ...
getComputedStyle () is a JavaScript function that expects a JavaScript object, not a jQuery object. Pass it reveal[0] and it will work.
Read more >TypeError: Argument 1 of Window.getDefaultComputedStyle is ...
I use hack for support of client-size XSLT: var defaultNS = document.documentElement.namespaceURI; /** * Use the given object to override the given methods ......
Read more >Window.getComputedStyle() - Web APIs | MDN
The Window.getComputedStyle() method returns an object containing the values of all CSS ... The Element for which to get the computed style.
Read more >JavaScript Window getComputedStyle() Method - W3Schools
The getComputedStyle() method returns a CSSStyleDeclaration object . Computed Style. The computed style is the style used on the element after all styling ......
Read more >Get Computed Style of an Element - JavaScript Tutorial
Introduction to JavaScript getComputedStyle() method. The getComputedStyle() is a method of the window object, which returns an object that contains the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello @iReivax1! Like the comment above by atul-mourya, if that script youโve written is all in
render
method the same error can be thrown. You should put creating panoviewer part incomponentDidMount
. If you provide me some more detailed code of yours, I can help you with what exactly you have to fix ๐This issue/PR has been automatically marked as stale because it has not had any update (including commits, comments, labels, milestones, etc) for 30 days. It will be closed automatically if no further update occurs in 7 day. Thank you for your contributions!
ํ๊ธ
์ด ์ด์/PR์ commits, comments, labels, milestones ๋ฑ 30์ผ๊ฐ ํ๋์ด ์์ด ์๋์ผ๋ก stale ์ํ๋ก ์ ํ๋์์ต๋๋ค. ์ดํ 7์ผ๊ฐ ํ๋์ด ์๋ค๋ฉด ์๋์ผ๋ก ๋ซํ ์์ ์ ๋๋ค. ํ๋ก์ ํธ ๊ฐ์ ์ ๊ธฐ์ฌํด์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.