Confusion with JavaScript Functions and Embedding in Webflow

In this meeting, David raised a JavaScript question regarding the usage of the function "slider one". He explained that he had two different scripts, both containing the "slider one" function. When he commented out the second script, he encountered an error stating that "slider one" was not a function, even though it was defined in the first script.


After discussing the issue, it was determined that the problem was due to the function "slider one" being defined inside a Webflow dot push block. This meant that it was only accessible within that specific block and was not appended to the window object. On the other hand, the second script added "slider one" to the window object, making it globally accessible. To resolve the issue, it was suggested that David remove the "window dot" part when using the local version of "slider one" in the code below. By doing so, he should be able to use the local version instead of the globally accessible one. The meeting concluded with David agreeing to implement the suggested changes and seeking further assistance if needed.


(Source: Office Hours 1/20 )

State Change Members Can View The Video Here
chris-montgomery-smgTvepind4-unsplash.jpg

View This Video Now

Join State Change Risk-Free