Delay on javascript loading

151 views Asked by At

I'm new with javascript and I don't understand why the javascript file takes so long to load.

My page right now consists of a svg image file of a house, in which I've embedded several path objects. When I hover over a room, I'm using a javascript function on mouseover event of the path objects to highlight that room, changing the path's fill and opacity properties.

The script works fine and the rooms are highlighted as I wanted, but in order for the script functions to start working it takes several seconds (30 seconds or longer). Once the first room starts to be highlighted, the others work fast and smooth.

Is there something wrong with the javascript loading function?

I'm using this code line inside the svg file:

<script type="text/javascript" xlink:href="Script.js" xlink:actuate="onLoad" xlink:show="other" xlink:type="simple" />

I also tried to load the javascript file directly on the html file, but I ended up getting the same delay.

0

There are 0 answers