Questions tagged [includejs]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
58 views

Pass Craft Field String to Javascript Function

I tried different solutions given here, here and here. But I get nothing to work, probably missing something small and simple. I have this variable in a .js File: var dziFilesUrl = 'http://...
0
votes
0answers
18 views

{% JS %} getting non-escaped characters

I'm trying to integrate a typewriter javascript using rows to feed the strings. (Client requested feature...) So, I found a good script, but when I try to put in a string like this into a table row: ...
4
votes
1answer
192 views

Register JS files at the end of the body tag in the Control Panel

I would like to add my own external JS sources at the very end of the body tag in the Craft control panel. I've already tried using: {% do view.registerJsFile("<CDN_URL>", {position:3}) %} ...
1
vote
0answers
67 views

Avoiding includeJsFile, includeJS from caching

In my template, I have an includeJSFile that loads properly on the first load, but disappears on subsequent loads. The includeJSFile is outside the caching tags, so I'm not sure why this is still ...
1
vote
1answer
79 views

includeJs not consistently working

Using Craft 2 and I have a Matrix Block which can contain a carousel item, which uses JS/jQuery. Because the content editor can add multiple instances of this Matrix Block I can’t set up these ...
1
vote
1answer
479 views

Simplify Twig/JS loop code

Can any help simplify this js/twig code? The code links to some tabs that show floorplans of the property being sold. The specified aria-controls refers to a supertable field called floorLevel that ...
1
vote
1answer
248 views

Pass Craft field object to JavaScript function

I need to pass an entire Craft object into a JavaScript function. I followed the instructions in this post, however this only covers passing in a string. {% includeJsFile "/js/homepage.js" %} {% set ...
3
votes
3answers
1k views

Can you set async defer when using {% includeJsFile %}?

Is there a way to set async defer on a <script> tag with the built in: {% includeJsFile %} It's for Google Maps e.g.: <script src="https://maps.googleapis.com/maps/api/js?key=...
3
votes
2answers
972 views

how to includeJsFile in head instead of body

I am using this code to include a js file, but it adds to the <body>: {% includeJsFile '/path/script.min.js' %} I need to add it to the <head> instead, how can I do?
1
vote
1answer
569 views

minify javascript with includeJS

If i include javascript in a template using: {% set myJS %} //some JS in here {% endset %} {% includeJS myJS %} Is there a way to minify the javascript that gets output on the page? I had a look at ...