Jump to content

How to include jQuery script on Page Display Record Template


sobrenome

Recommended Posts

Posted

I need to add keyframes to CSS dynamically, so I will need to insert a script to database record display template.

The jQuery library is available on database record display template?

In my case, can I simple add this example script to the end of the template code to dynamically insert the css statement?

<script>
var supportedFlag = $.keyframe.isSupported();
$.keyframe.define([{
    name: 'trapdoor-sequence',
    '0%': {'height': '70px'},
    '30%': {'height': '10px'},
    '60%': {'height': '30px'},
    '100%': {'height': '10px'}
}]); 
</script>

 

 

 

Posted

I have done a quick test with:

<script>
$(document).ready(function(){
  $("body").append("random sentence");});
</script> 

Not working...

:cry:

Where did you add it? jQuery should be loaded as a window element so should be available throughout the framework.

Posted

Hello @Jim M,

Let me explain better. I am just parsing the script code above anywhere in the record display template of the database (Pages > Templates > HTML > Database Templates > Display > record). It doesn't work.

I supose that to load as a window element I have to create a javascript file with the code (Pages > Templates > JS > Page JS > JS > teste_name.js), right?

I have done that, but could not find any documentation on how to include this javascript file in the display record template.

I also have not found any documantation on how to add variables to the script that should be dynamically inserted on each record display.

Could you help? Thanks!

Posted

I don't see why not. You can also create a Javascript file (if you are using pages) and include it on the pages you need by editing the page includes.

Do you know how to include it? ?

Posted

Well adding variables is not really what I would be best at because I'm terrible at javascript. Sorry.

 

No problem. But how to include the javascript file in the record display template?

Posted

I'd figure you just have to add it to the template within the foreach.

I guess you could also attempt to add it into the "display" for the field that you are trying to get the variable for as well.

Posted

To include a template file, the code is something like this:

{template="includeMeta" app="core" group="global" location="global" params=""}

But how to include a javascript file?

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...