Javascript doesn't work on website but runs on codepen
Go to solution
Solved by Ominous,
You need to create a dedicated script tag for your JQuery include and your own custom script as such:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js" type="text/javascript"></script> <script> // added the above script tag and ended the include script tag on the line above. $(document).ready(function () { $("#slideshow > div:gt(0)").hide(); setInterval(function() { $('#slideshow > div:first') .fadeOut(4000) .next() .fadeIn(4000) .end() .appendTo('#slideshow'); }, 3000); }); </script>
Behaviour of a script tag with both a src="" attribute and content seems to be inconsistent. Some browsers may run this but its much better to separate them. Your Codepen works because its effectively being compiled into the above.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now