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 FreeTop 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
Top GitHub Comments
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일간 활동이 없다면 자동으로 닫힐 예정입니다. 프로젝트 개선에 기여해주셔서 감사합니다.