Trigger an interaction by custom URL

I have an expandable content (accordian) div on a particular page on my site.

I would like to click a link on page 1 and trigger an accordian content div on page 2 to open up.

Is it achievable?

http://dr-adam-davis.webflow.io/

Linking (services) links on Home Page to Services Page subsections.

Hi @Samuel_Gualtieri, thanks for the good question ! At the moment, it is not possible to trigger an interaction by url. One thing you can do, is to setup an interaction with a page load trigger, and when page 2 is loaded, then have the interaction run after page assets are loaded.

Thanks for the answer @cyberdave — I suppose I could only have 1 trigger if I did it that way, and no way to link to it… i.e. every time the page was loaded (from navigation or otherwise).

Is there a way to force the div to open with javascript via a URL?

Just wanted to share in case anyone had the same question. This comes in really handy if you’re making your own accordion expanders.

  1. Set each content div class to something unique (.eyes, .ears, .chin etc… in my case)

  2. Set custom URLs on link to target page and include “?eyes” “?ears” “?chin” etc… in my case my URL looks like this"/services?ears"

  3. Then create a variable in document.ready that checks the URL for “?ears” “?eyes” etc and calls the function to set the height to auto. My code looks like this:

     $(document).ready(function(){
     
     function accordian(){
         var url = window.location.href.split('?')[1];
    
         if (url == 'eyes') {
             $('.eyes').css({'height':'auto'})
         }
     }
         accordian()   
     });
    

Easy as that!

Interesting idea. wouldn’t it be easier if each ‘div’ was a section and you simply added an interaction to that section that would open on scroll or load?

I have an interaction that always triggers when you go to it’s section on the page, http://einclick.webflow.io/#services (ignore the other crap…clients thinking that more ‘stuff on page’ is better for some reason…sigh…ruins a perfectly focused page element…)

This interaction happens no matter where I am on the site and use that link.

What I am trying to achieve is a bit more complex than that as I am trying to pass a trigger from one page to another. Javascript helps with this, as there is no way to do that currently with Webflow natively.

I saw this: How to Create an Accordion Effect - Webflow Tips - Forum | Webflow

Has anyone tried it?

I suppose you could always have a separate page for each section of the accordion where the element clicked is default open (displayed) and the others are closed (hidden). This would mean a bunch of redundancy pages but would accomplish the same result with the user being none-the-wiser essentially.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.