javascript - How do I integrate a codepen?

EDIT: Answered own question with some fiddling aroundBit of a newbie question but sure someone here can help:I am simply

EDIT: Answered own question with some fiddling around

Bit of a newbie question but sure someone here can help:

I am simply rubbish with JS but am learning on my feet.

I have created a simple codepen and want to use it in certain custom pages on my wordpress site.

The question is - how and where do I add the JS portion so that my site recognises it?

Also, at the bottom of the HTML portion is says:

<script src=".3.1/jquery.min.js"></script>

....which I assume will need to be added somewhere too?

Thanks.

EDIT: Answered own question with some fiddling around

Bit of a newbie question but sure someone here can help:

I am simply rubbish with JS but am learning on my feet.

I have created a simple codepen and want to use it in certain custom pages on my wordpress site.

The question is - how and where do I add the JS portion so that my site recognises it?

Also, at the bottom of the HTML portion is says:

<script src="https://cdnjs.cloudflare/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

....which I assume will need to be added somewhere too?

Thanks.

Share Improve this question edited May 30, 2019 at 11:40 Shaun21uk asked May 30, 2019 at 10:16 Shaun21ukShaun21uk 311 silver badge8 bronze badges 3
  • Stylesheets and scripts are necessary to your pen to work correctly. and wordpress have it's own way to inject script/style files called enqueuing. but in this case jQuery is already loaded by wordpress so you don't need to include jquery – Vishwa Commented May 30, 2019 at 10:59
  • I see, so I can live without that line. So the css portion also seems to reference: maxcdn.bootstrapcdn/bootstrap/3.3.6/css/bootstrap.min.css I added this to my child theme functions.php as enqueue and it has broken my site. Man it seems like it should be such a simple task :/ – Shaun21uk Commented May 30, 2019 at 11:01
  • Actually, it is.. it'll be even more simple once you get the hang of it. good luck :) – Vishwa Commented May 31, 2019 at 5:30
Add a comment  | 

1 Answer 1

Reset to default 0

All sorted.

My theme actually had a section for custom javascript in the theme options.

I added the code there and used the enqueue for the bootstrap - all working fine now.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745451248a4628281.html

相关推荐

  • javascript - How do I integrate a codepen?

    EDIT: Answered own question with some fiddling aroundBit of a newbie question but sure someone here can help:I am simply

    8小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信