Skip to main content

On Click or On Hover setting opens the widget

See how to embed a widget and trigger it by clicking on a specific element in your theme, follow this step-by-step guide.

D
Written by Dharmik Valani
Updated over 5 months ago

Open Your Store URL

  1. Start by opening your Shopify store in a web browser.

  2. Navigate to the page where you want to embed the widget.

Open Developer Tools

  1. Right-click anywhere on the page and select Inspect to open the Developer Tools.

  2. Locate the element you want to use as a trigger. This is the element that, when clicked, will open the widget.

Find the Unique ID or Classname

  1. In the Developer Tools, hover over the element to highlight its HTML code.

  2. Press CTRL+F and search for its id or Classname.

    1. If the element has an id, it is unique and can be used directly.

    2. If the element does not have a unique classname, try combining multiple class names to ensure uniqueness.

Copy the ID or Classname

  • Once you identify a unique ID or Classname, copy it for later use.


Customize the Widget

  • Now, open the widget that you want to embed and customize it as per your requirements

Open Display Condition Settings

  1. Navigate to the Display Condition settings of your widget.

  2. Go to the Trigger Settings section.

Add the ID or Classname

  1. Locate the On Click Settings or On Hover Settings option.

  2. Paste the id/classname

    • If you copied an id, use #id_name (e.g., #header-button).

    • If you copied a classname, use .class_name (e.g., .shop-button).

Save and Publish

  • Once you've added the correct selector, save the settings and publish the widget. Now, whenever the selected element is clicked, the widget will appear.


Final Look:

In this example, we have added an "On Click" trigger on the Contact element of the nav-bar list, which will open the Book Appointment Widget. Similarly, you can add "On Hover" Trigger as well

Did this answer your question?