0
Welcome Guest! Login
0 items Join Now

Execute Javascript Atom from URL: Gantry5

  • Execute Javascript Atom from URL: Gantry5

    Posted 8 years 11 months ago
    • I am looking for an easy to understand way to execute javascript stored inline in an atom.

      For example: Using the Salient Template as a test.

      1. On my Home page Template under Page Settings, I enabled atoms and dragged the Custom CSS /JSS element down.

      2. Clicked on Settings for Custom CSS / JS and added my javascript code. Also making sure to strip out the <Script> </script> code. So my Javascript code looks like this:

      type='text/javascript' src='https://feed.site.com/FeedStore/GetFeed.ashx?FeedId=[REMOVED]&locale=en-us&partnerid=999999&CompanyName=Company%20Name&width=600px&height=250px'

      I am planning on using a banner showcase to rotate pictures and when someone clicks on the banner, I want to execute the javascript code. Currently, I'm using Roksprocket for the banner display and would also like to find out how to execute the assigned javascript code from inside the module. After all is said an done, I could have up to 10 pictures with associated JS scripts that need to be called.

      Sounds like an opportunity for a basic step by step, easy to understand and clearly exaplained tuturial.

      Hoping to use the answer to this question to duplicate the same functionality for a chat button on another page.

      Thanks in advance for your help.
      David
    • Last Edit: 8 years 11 months ago by David@IOC.
    • My only expectation is to EXCEED yours!.
    • Matt's Avatar
    • Matt
    • Preeminent Rocketeer
    • Posts: 22276
    • Thanks: 3224
    • messin' with stuff

    Re: Execute Javascript Atom from URL: Gantry5

    Posted 8 years 11 months ago
    • <script> tags should be removed when you have a complete INLINE script you want to insert in the Inline Javascript box... just paste the actual script itself in that field is what that means... to add an additional <script> tag to the <head> section which calls your script use the File Location field in your Atom and simply stick your URL in there... feed.site.com/ ....
    • Last Edit: 8 years 11 months ago by Matt.
    • SEARCH the forum first! These boards are rich in knowledge and vast in topics. This includes searching just the 'Solved' forums, using Google, and using ChatGPT :woohoo:

Time to create page: 0.077 seconds