Codepen & jquery plugin

Codepen & jquery plugin
0

#1

Hi there. Not directly related to Free Code Camp but… Anyone able to help with a small CodePen related issue? I built a simple web page that counts down the number of days until christmas using jquery and a jquery plugin. Everything works fine from my github account (https://peterlewicki.github.io/christmas_countdown/). However I also wanted to showcase it on CodePen but the countdown is not working there . https://codepen.io/peterlewicki/pen/MEzyzW I’ve added the jquery libraries to the settings page but still nothing. I know it’s probably something small and stupid that I’m overlooking but if anyone could spare 2 minutes to help me I’d be grateful. Cheers and thank you in advance.


#2

In the HTML textarea you should only put everything that should go in between <body></body>. All the JS imports should be in the settings and all the JS code should be in the JS textarea.

Also, it seems like you are refering to local files (e.g. js/jquery.plugin.min.js), where should CodePen fetch these from?


#3

Aha. I need to host the plugins somewhere online?


#4

Yes, but you already have them on GitHub, so you can just get the “raw” version from there:
https://raw.githubusercontent.com/peterlewicki/christmas_countdown/master/js/jquery.plugin.min.js


#5

Super. Thank you for your time and help. :slightly_smiling_face:


#6

Hi again. I tried linking the javascript/jquery “Raw” files from my github folders to the codepen file (https://codepen.io/peterlewicki/pen/MEzyzW), but something is amiss and the plugin isn’t working. There’s something I’m not getting here. Thanks.


#7

You can’t use any <script> tag in the JS editor. Only valid JS code can go there. Try moving the JS files in the src to the JS settings instead.


#8

that didn;t seem to work either.


#9

Weird. I’m getting warnings saying the page fails to load the JS files from GitHub.


#10

So what should it do? I don’t see any links to your github, but the countdown works fine.