Hi! I wrote code for a typewriter effect, however it does not work on the site. It works when I run it in a browser but not on the site. Someone said the line is trying to import a file that does not exist. I think the problem is that the typed.js file is stored locally on my computer. Can someone please help me / tell me how I can make this public / work on my site?!
Here is my code:
body
{
margin: 0;
padding: 0;
background: [#e91e63](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23e91e63) ;
}
h1
{
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
text-align: center;
margin: 0;
padding: 0;
font-family: sans-serif;
color: [#fff](https://www.wix.com/code/home/forum/search/posts%3Fquery=%23fff) ;
font-size: 40px;
text-shadow: 0 2px 5px rgba(0,0,0,.5);
}
Michael,
I see that you asked the same question before .
You cannot embed HTML code into a Wix Code site. WixCode understands all of Javascript, except for anything that accesses the DOM. This keeps the user from inadvertently “breaking” something. I myself tried to hack things from the code, from an iFrame, and in my dreams, but WixCode wasn’t having any of it.
Accessing document elements such as div, span, button, etc is off-limits. The way to access elements on the page is only through $w. One small exception is the $w.HtmlComponent (which is based on an iFrame). This element was designed to contain vanilla HTML and it works just fine. You just can’t try to trick it by using parent, window, top, etc. Same goes with the Javascript evaluate() function. It is sandboxed and does not allow access to the DOM.
Javascript files can be added to your site’s Public folder , but the same limitations apply - no access to the DOM.
Yisrael