Same Code Does Not Work In A Different IDE – html,css

so I have the following code:

document.addEventListener("DOMContentLoaded", function(event) { 

// Get a reference to the <path>
var path = document.querySelector('#star-path');

// Get length of path... ~577px in this case
var pathLength = path.getTotalLength();

// Make very long dashes (the length of the path itself) = pathLength + ' ' + pathLength;

// Offset the dashes so the it appears hidden entirely = pathLength;

// Jake Archibald says so

// When the page scrolls...
window.addEventListener("scroll", function(e) {
  // What % down is it? 
  // Had to try three or four differnet methods here. Kind of a cross-browser nightmare.
  var scrollPercentage = (document.documentElement.scrollTop + document.body.scrollTop) / (document.documentElement.scrollHeight - document.documentElement.clientHeight);
  // Length to offset the dashes
  var drawLength = pathLength * scrollPercentage;
  // Draw in reverse = pathLength - drawLength;
  // When complete, remove the dash array, otherwise shape isn't quite sharp
 // Accounts for fuzzy math
  if (scrollPercentage >= 0.99) { = "none"; = "#47AF9A";
  } else { = "none"; = pathLength + ' ' + pathLength;
body {
  /* feel free to change height */
  height: 5000px;
  background: linear-gradient(
    to bottom,

h1 {
  font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; 
  font-weight: 300;
  color: white;
  text-transform: uppercase;
  text-align: center;
  font-size: 22px;
  letter-spacing: 5px;
  font-weight: 100;
  padding: 25px 15px;
  text-shadow: 1px 1px 1px #333;

#star-svg {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 150px;
  height: 150px;
  margin: -75px 0 0 -75px;

    <link href="style.css" rel="stylesheet"/>
  <script src="script.js"></script>

<svg xmlns="" viewBox="0 0 200 200.6" id="star-svg">
  <path fill="none" stroke="white" stroke-width="2" id="star-path" d="M45.33 78.22L87.67 78.22L87.67 133L121.05 133L121.05 0L87.67 0L87.67 49.33L45.33 49.33L45.33 0L11.95 0L11.95 133L45.33 133L45.33 78.22Z"></svg>

This code works here perfectly fine but it does not work on the IDE I am working in, like when I scroll, I do not get the lines to draw but it just shows the overall output which is the H letter. Could you guys please take a look here:

P.S. You might need to make an account as it is but could you guys please take a look at it, it will be really helpful and I would really appreciate it. The problem that I can think of is that I am missing a reference in my code over there, it works here because StackOverFlow creates a reference but not every IDE does. Any Suggestions?

65 thoughts on “Same Code Does Not Work In A Different IDE – html,css”

  1. 712263 57458of course like your web-site even so you need to have to check the spelling on quite a couple of of your posts. Several them are rife with spelling issues and I to uncover it extremely bothersome to inform the reality even so Ill surely come back again. 870874


Leave a Comment