{"id":400,"date":"2022-08-02T15:04:25","date_gmt":"2022-08-02T15:04:25","guid":{"rendered":"https:\/\/www.smashpops.com\/blog\/?page_id=400"},"modified":"2024-11-05T10:20:13","modified_gmt":"2024-11-05T10:20:13","slug":"how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element","status":"publish","type":"page","link":"https:\/\/www.smashpops.com\/blog\/how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element\/","title":{"rendered":"How to display the pop-up when clicking on a custom button (or any HTML element)"},"content":{"rendered":"<p>In SmashPops there is a feature to let you display the pop-up when clicking on a custom button on your page (or any HTML element actually) that you can specify via a CSS selector.<\/p>\n<ol>\n<li>Let&#8217;s say that we want the pop-up to be displayed when clicking on this <strong>specific button.<\/strong><br \/>\n<img loading=\"lazy\" class=\"aligncenter wp-image-401 size-large\" src=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton1-1024x485.jpg\" alt=\"\" width=\"1024\" height=\"485\" srcset=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton1-1024x485.jpg 1024w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton1-300x142.jpg 300w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton1-768x364.jpg 768w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton1-1536x728.jpg 1536w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton1-2048x971.jpg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/li>\n<li>First, go to <strong>SETTINGS<\/strong> and <strong>Display rules.<\/strong><br \/>\n<img loading=\"lazy\" class=\"aligncenter wp-image-411 size-large\" src=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton22-1024x485.jpg\" alt=\"\" width=\"1024\" height=\"485\" srcset=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton22-1024x485.jpg 1024w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton22-300x142.jpg 300w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton22-768x364.jpg 768w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton22-1536x728.jpg 1536w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton22-2048x971.jpg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/li>\n<li>Select <strong>User clicks on a custom HTML element<\/strong> and enter the CSS selector of your button. For instance, if your button is a &lt;button id=&#8221;my-button&#8221;&gt;Spin the wheel&lt;\/button&gt; on your page, the CSS selector would be <strong>#my-button<\/strong> . If you have multiple buttons, you may want to use a class (ids are used for single elements only) : so if your buttons look like &lt;button class=&#8221;wheel-btn&#8221;&gt;Spin the wheel&lt;\/button&gt;, the CSS selector would be <strong>.wheel-btn<\/strong>\u00a0.One thing to know though is that a click on your button will display the popup only if it was supposed to be displayed. So for instance, if you set the <strong>Do not display after the user performed the action<\/strong> rule, the popup will no longer be displayed if the visitor has already played, even if he clicks on your custom button.\n<div>\n<div>If you want the popup to always be displayed when one clicks on the button, you need to set <strong>Always display (no max)<\/strong> and <strong>Display after the user performed the action.<\/strong> But if you do this, you may want to remove any other rule you may have (like <strong>Display after 10 seconds<\/strong>, <strong>Display after scrolling 70% of the page<\/strong>), since it could be annoying for the user to always see the popup when he hasn&#8217;t asked for it.<\/div>\n<\/div>\n<p><img loading=\"lazy\" class=\"aligncenter wp-image-412 size-large\" src=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton33-1024x485.jpg\" alt=\"\" width=\"1024\" height=\"485\" srcset=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton33-1024x485.jpg 1024w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton33-300x142.jpg 300w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton33-768x364.jpg 768w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton33-1536x728.jpg 1536w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton33-2048x971.jpg 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<p>If you plan on having your custom button only on one page, you may want to take a look at <a href=\"https:\/\/www.smashpops.com\/blog\/how-to-display-your-pop-up-on-a-specific-page\/\">this tutorial<\/a> to learn how to have the popup displayed on specific pages only.<\/p>\n<p>Bonus : an alternative way to trigger the popup display when clicking on text is by inserting a link to &#8220;#sp-game&#8221; (either in rich text or as a menu item for instance). You can leave the &#8220;User clicks on a custom HTML element.&#8221; input blank in this case.<\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-751\" src=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2024\/03\/link2.jpg\" alt=\"\" width=\"314\" height=\"246\" srcset=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2024\/03\/link2.jpg 421w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2024\/03\/link2-300x235.jpg 300w\" sizes=\"(max-width: 314px) 100vw, 314px\" \/><\/p>\n<p><img loading=\"lazy\" class=\"alignnone wp-image-752\" src=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2024\/03\/link.jpg\" alt=\"\" width=\"242\" height=\"432\" srcset=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2024\/03\/link.jpg 256w, https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2024\/03\/link-168x300.jpg 168w\" sizes=\"(max-width: 242px) 100vw, 242px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>If you use PageFly, here is a video tutorial :<\/p>\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/AK9ILzuQYjI?si=JzIzAP5MT3lt0ree\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p>If you use eComposer, here is a video tutorial :<\/p>\n<p><iframe title=\"YouTube video player\" src=\"https:\/\/www.youtube.com\/embed\/dgl58i1fxLE?si=-4Z9FSFThBUuxyWk\" width=\"560\" height=\"315\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In SmashPops there is a feature to let you display the pop-up when clicking on a custom button on your page (or any HTML element actually) that you can specify via a CSS selector. Let&#8217;s say that we want the pop-up to be displayed when clicking on this specific button. First, go to SETTINGS and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v14.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to display the pop-up when clicking on a custom button (or any HTML element) - SmashPops Blog<\/title>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<meta name=\"googlebot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<meta name=\"bingbot\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.smashpops.com\/blog\/how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to display the pop-up when clicking on a custom button (or any HTML element) - SmashPops Blog\" \/>\n<meta property=\"og:description\" content=\"In SmashPops there is a feature to let you display the pop-up when clicking on a custom button on your page (or any HTML element actually) that you can specify via a CSS selector. Let&#8217;s say that we want the pop-up to be displayed when clicking on this specific button. First, go to SETTINGS and [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.smashpops.com\/blog\/how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element\/\" \/>\n<meta property=\"og:site_name\" content=\"SmashPops Blog\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-05T10:20:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton1-1024x485.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.smashpops.com\/blog\/#organization\",\"name\":\"SmashPops\",\"url\":\"https:\/\/www.smashpops.com\/blog\/\",\"sameAs\":[],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.smashpops.com\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2020\/04\/icon1024.png\",\"width\":1024,\"height\":1024,\"caption\":\"SmashPops\"},\"image\":{\"@id\":\"https:\/\/www.smashpops.com\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.smashpops.com\/blog\/#website\",\"url\":\"https:\/\/www.smashpops.com\/blog\/\",\"name\":\"SmashPops Blog\",\"description\":\"Everything you need to know about e-commerce and email collection.\",\"publisher\":{\"@id\":\"https:\/\/www.smashpops.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.smashpops.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.smashpops.com\/blog\/how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.smashpops.com\/blog\/wp-content\/uploads\/2022\/08\/custombutton1.jpg\",\"width\":2561,\"height\":1214},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.smashpops.com\/blog\/how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element\/#webpage\",\"url\":\"https:\/\/www.smashpops.com\/blog\/how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element\/\",\"name\":\"How to display the pop-up when clicking on a custom button (or any HTML element) - SmashPops Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.smashpops.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.smashpops.com\/blog\/how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element\/#primaryimage\"},\"datePublished\":\"2022-08-02T15:04:25+00:00\",\"dateModified\":\"2024-11-05T10:20:13+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.smashpops.com\/blog\/how-to-display-the-pop-up-when-clicking-on-a-custom-button-or-any-html-element\/\"]}]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.smashpops.com\/blog\/wp-json\/wp\/v2\/pages\/400"}],"collection":[{"href":"https:\/\/www.smashpops.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.smashpops.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.smashpops.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.smashpops.com\/blog\/wp-json\/wp\/v2\/comments?post=400"}],"version-history":[{"count":16,"href":"https:\/\/www.smashpops.com\/blog\/wp-json\/wp\/v2\/pages\/400\/revisions"}],"predecessor-version":[{"id":798,"href":"https:\/\/www.smashpops.com\/blog\/wp-json\/wp\/v2\/pages\/400\/revisions\/798"}],"wp:attachment":[{"href":"https:\/\/www.smashpops.com\/blog\/wp-json\/wp\/v2\/media?parent=400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}