• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Running script after Muse loads jQuery

Community Beginner ,
Jun 15, 2018 Jun 15, 2018

Copy link to clipboard

Copied

Hi!

I've got a site that uses a cookie banner provided by OneTrust.com. I've placed the code that calls the JavaScript for the banner in the header (as instructed by OneTrust). OneTrust also provides a version of jQuery. When opening the site none of the content is loaded and only the banner is shown (only the text, not its background), and only when reloading the page does the rest load. This error exists almost exclusively on mobile phones. When disabling the jQuery provided by OneTrust the banner does not show at all. I know that Muse provides a version of jQuery, how can I make the cookie banner use that version instead? It seems that jQuery is loaded last in Muse and the cookie banner is loaded before that, making it not pop up at all. If I could run the script after all the content (and Muse's scripts) have been loaded, maybe it would work?

Thank you!

/Sven

Views

652

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 16, 2018 Jun 16, 2018

yes the load | run order for code in Muse is [page head] then [page body] then [Master] head and [Master] body so for times when you need an order to things... like a popup timer you can split the code into different areas to have them run at different (but sequential) times

Screenshot (964).png

Screenshot (966).png

Screenshot (965).png

p.s, remember this bootstrap demo Nancy?

Votes

Translate

Translate
Guest
Jun 15, 2018 Jun 15, 2018

Copy link to clipboard

Copied

The important thing is have a jQuery version compatible with OnTrust. It does not matter where it comes from.

When javascript libraries are imported, they become available for the entire page.

Did you try to inspect the page content (Right button of the mouse> Inspect)?

A good thing would be to share the site here, so we can look at it together.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 15, 2018 Jun 15, 2018

Copy link to clipboard

Copied

Try this one that does not rely on jQuery.  Paste this code into your document's <head> tag.

<!--Cookie Conset CSS-->

<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />

<!--Cookie Consent JS-->

<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>

<script>

//Invoke Cookie Consent on page load

window.addEventListener("load", function(){

window.cookieconsent.initialise({

  "palette": {

    "popup": {

      "background": "#000"

    },

    "button": {

      "background": "#f1d600"

    }

  }

})});

</script>

Nancy O'Shea— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 16, 2018 Jun 16, 2018

Copy link to clipboard

Copied

LATEST

yes the load | run order for code in Muse is [page head] then [page body] then [Master] head and [Master] body so for times when you need an order to things... like a popup timer you can split the code into different areas to have them run at different (but sequential) times

Screenshot (964).png

Screenshot (966).png

Screenshot (965).png

p.s, remember this bootstrap demo Nancy?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines