Custom jquery - Seamless play

chrystalb21
chrystalb21 Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 27 ✶ Headliner ✶

Hello all,

I'm wondering how you target the pageDIV in seamless play to add classes?

Tagged:

Answers

  • andrew-robertson
    andrew-robertson Community Member Posts: 309 ♦ Idol ♦
    edited November 18, 2022
  • chrystalb21
    chrystalb21 Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 27 ✶ Headliner ✶

    Hi Andrew,

    That didn't work for me. I'm guessing they way it's handled is different since 2015. For the jquery function for getDisplayWindow, triv$(getDisplayWindow()).find('p').css('background-color','red'); works for me when testing, but it looks like none of the other functions listed in the reference is available.

    Any ideas?

    I'll also need to use something like the getCurrentPageID because for normal publish, the ID is pageDIV, but not for seamless.



  • andrew-robertson
    andrew-robertson Community Member Posts: 309 ♦ Idol ♦
    edited November 21, 2022

    From my experience, it is still relative. The group here on the forum helped me create the following code that I use to dynamically get the ID of an object based on the CSS class. It helps when trying to do advanced JavaScript work.

    //Gets the item's ID using the class name.
    function getIdFromClass(_classIn){
        let uniqueID = triv$(_classIn, getDisplayDocument()).first().attr("id");
        return uniqueID;
    }
    

    Are you remembering to add the triv$ in front of any/all JavaScript you are using (of course unless you including your own version of JQuery manually)? Do you have sample code available that you are trying to use?

    Andrew R.
    Developing content since 2010 using a mixed bag of tools.
  • chrystalb21
    chrystalb21 Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 27 ✶ Headliner ✶

    Hi Andrew,

    I've actually got all of my code written and working when not publishing with seamless, but have to rewrite to use Lectora's JQuery because publishing to seamless puts my code in the wrong place to access the page objects. Side note, the only reason I'm doing this is because I only need to publish with seamless since we have audio that is set for autoplay. Unless it is published with seamless, Firefox and mobile delivery has tap/click to continue prompt on every page. If anyone has a solution for non-seamless publish, that would be the best, then no rewriting would be needed.

    I'm not having a problem using the same type of code you are using to access the items on the page itself, but I need to access the containing div (which is the pageDIV in non-seamless publishing, and a unique page number with seamless.

    The following does work when not published with seamless.

    triv$("#pageDIV").addClass("maindiv");

    The div I'm trying to target with seamless does have a class of .pageDIV, but using the following does not work.

    triv$(".pageDIV").addClass("maindiv");