Explore the community Forums Lectora Online Lectora Online Questions & Answers CSS/Javascript is not working the same in Online and Inspire Reply To: CSS/Javascript is not working the same in Online and Inspire

#370616 Score: 1
Profile photo of Joe Wieloch
Joe Wieloch
friend finder
LUC16 Attendee
verified member
wise owl
LUC17 Attendee
picture perfect
69 pts

Ok, so a couple of things.

  1. We need to fix the issue with not being able to edit the css file. A workaround is to insert an external html object that is type Meta tags, then define your classes there within a <style> tag, for example:
    .sky {background-color: powderblue;}
  2. I really try to stay away from using the html name explicitly, it makes it hard to reuse things.  For example you could just put an on show action attached to the entry field in your example.  It would be a run javascript action with the following code:
    What this does is substitute the action’s parent object’s html name for you.  The triv$ is an internal jQuery reference (this is only currently available in Lectora Online).  The html name gives you access to DOM elements and some methods on the runtime object.  dCon in this case is a reference to the DOM input element. %HTMLNAME%.div would be the higher level div which is used for positioning.
  3. If you wanted to do all input elements on a page you could just do an on page show action that runs the following javascript:  triv$(‘input’).addClass(‘entry1’);
  4. If you are doing any more sophisticated scripting you might want to consider global references for the objects you are working with. Do this by adding an action on page show to the objects you will be working with and run the following javascript:
     window.myFormObject1 = %HTMLNAME%;
    Then in other scripting you can safely reference window.myFormObject1 and then the scripting becomes portable, meaning you can copy the objects to another title or library object and it will not break because object html names change.  You can see an example of this in my title here: https://community.trivantis.com/forums/topic/add-bookmark-to-multiple-pages/

Hope this helps, we are working on an API that will work across Lectora (Online and Desktop).  I am trying to make this a priority since Lectora really is unique in letting you customize everything through scripting if you want to.

– Joe

This post has received 1 vote up.