Invision Community 4: SEO, prepare for v5 and dormant account notifications By Matt Monday at 02:04 PM
sobrenome Posted July 3, 2015 Posted July 3, 2015 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>
Morrigan Posted July 3, 2015 Posted July 3, 2015 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.
sobrenome Posted July 3, 2015 Author Posted July 3, 2015 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!
sobrenome Posted July 3, 2015 Author Posted July 3, 2015 I have done a quick test with: <script> $(document).ready(function(){ $("body").append("random sentence");}); </script> Not working...
Jim M Posted July 4, 2015 Posted July 4, 2015 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.
sobrenome Posted July 4, 2015 Author Posted July 4, 2015 I have just added to the record display template, at "record".How to load as a window element?Thanks.
sobrenome Posted July 4, 2015 Author Posted July 4, 2015 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!
sobrenome Posted July 6, 2015 Author Posted July 6, 2015 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? ?
Morrigan Posted July 6, 2015 Posted July 6, 2015 Well adding variables is not really what I would be best at because I'm terrible at javascript. Sorry.
sobrenome Posted July 7, 2015 Author Posted July 7, 2015 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?
Morrigan Posted July 7, 2015 Posted July 7, 2015 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.
sobrenome Posted July 7, 2015 Author Posted July 7, 2015 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?
sobrenome Posted July 18, 2015 Author Posted July 18, 2015 Still don't know how to insert jQuery script in a page template.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.