Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted July 3, 20159 yr 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>
July 3, 20159 yr 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.
July 3, 20159 yr Author So jQuery is available on Pages! Thanks.I can't add a Javascript file because each record has its own specific script data for animation.Thanks!
July 3, 20159 yr Author I have done a quick test with: <script> $(document).ready(function(){ $("body").append("random sentence");}); </script> Not working...
July 4, 20159 yr I have done a quick test with: <script> $(document).ready(function(){ $("body").append("random sentence");}); </script> Not working... Where did you add it? jQuery should be loaded as a window element so should be available throughout the framework.
July 4, 20159 yr Author I have just added to the record display template, at "record".How to load as a window element?Thanks.
July 4, 20159 yr Author 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!
July 6, 20159 yr Author 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? ?
July 6, 20159 yr Well adding variables is not really what I would be best at because I'm terrible at javascript. Sorry.
July 7, 20159 yr Author 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?
July 7, 20159 yr 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.
July 7, 20159 yr Author 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?
Archived
This topic is now archived and is closed to further replies.