question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Argument 1 ('element') to Window.getComputedStyle must be an instance of Element

See original GitHub issue

Hi,

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:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
WoodNeckcommented, Dec 4, 2020

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 in componentDidMount. If you provide me some more detailed code of yours, I can help you with what exactly you have to fix 😃

0reactions
stale[bot]commented, Jun 26, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found