What is the process for incorporating a unique pop-up window in Shopify?

Hey there! I'm looking to incorporate a pop-up window that will appear when a user clicks on a link or button on the product page. This pop-up will display washing instructions, for example.

I came across this code snippet, but it doesn't seem to be working for me. I need a simpler solution :)

**HTML**
        <!-- {% if template contains 'product' %} -->
    <!-- begin pop-up wrapper -->
    <div class="size-popup">
            <!-- Button code -->
            <p class="pop-btn">Size Chart</p>
            <!-- the pop-up content code -->
            <div class="pop-up">
                    <span>x</span>
                    <div class="pop-content">
                            <!-- uncomment next line for shopify -->
                            <!-- <h2>{{ pages.size-chart.title }}</h2>
        {{ pages.size-chart.content }} -->
                            <p>Test text box content, delete me when on Shopify </p>
                    </div>
            </div>
            <!-- end pop-up content -->
    </div>
    <!-- end pop-up wrapper -->
    <!-- uncomment next line for shopify -->
    <!-- {% endif %} -->

**CSS**
div.size-popup .pop-btn {
        background: #dadada;
        width: 150px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        color: #3c3c3c;
        margin: 200px auto;
        border-radius: 5px;
        border: 1px solid #3c3c3c;
        cursor: pointer;
}

div.size-popup .pop-btn:hover {
        color: #064B58;
}

div.size-popup .pop-up {
        display: none;
        height: auto;
        width: 50%;
        margin: 40px auto;
        background: #fff;
        position: absolute;
        z-index: 1;
        border-radius: 5px;
        box-shadow: 0 0 20px #000;
        top: 20%;
        left: 25%;
}

div.size-popup span {
        border-radius: 0 0 30px 30px;
        margin-left: 90%;
        background: #000;
        color: #fff;
        font-size: 20px;
        height: 10px;
        padding: 0 5px;
        cursor: pointer;
}

div.size-popup .pop-content {
        box-sizing: border-box;
        padding: 5px 20px 20px 20px;
}

div.size-popup .pop-content p {
        font-size: 1em;
        margin-bottom: 10px;
}

**Javascript** 
/*  {% if template contains 'product' %} */
$(document).ready(function() {
        $('.pop-up').hide(0);

        $('.pop-btn').click(function() {
                $('.pop-up').fadeIn(300);
                $('.pop-btn').hide(0);
        });
        $('.pop-up span').click(function() {
                $('.pop-up').fadeOut(300);
                $('.pop-btn').show(0);
        });
});
/* {% endif %} */

Indeed, I have uncommented those lines.

Answer №1

For those looking to enhance their online store with a size chart, I highly recommend checking out AVADA Size Chart - a fantastic Size Guide app that is completely free to use.

Alternatively

If you prefer to explore other options, Shopify offers a comprehensive guide on how to add a size chart to product pages in their documentation. Discover more here.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Combine a variable and a string to create a new variable

@color-purple: "#ffffff" @colors: purple, light-purple, green, light-green, red, light-red, grey, light-grey, lightest-grey; .ColorsMixin(@i:0) when(@i =< length(@colors)){ //loop over icons array @color: extract(@colors, @i); //extract the ic ...

Expanding the functionality of Jquery with extend or bind techniques

Can someone clarify whether I should be using .bind() or .extend() and provide guidance on how to implement it? I am working with two checkboxes where a process is triggered once they are checked. In addition, there is a button that, when clicked, will ch ...

Transform the appearance of the datepicker with jquery-ui

Is it possible to customize the appearance of the calendar using css files from jquery-ui? <input type="text" id="dob"/> Check out this script: $(document).ready(function(){ $("#dob").datepicker(); }); See an example here. How can I style it ...

Determining Equality in JavaScript: Comparing 2 Objects

I'm currently working with 2 objects that will always have the same amount of properties, but their values may vary. In my attempt to check if the two objects hold the same values, I decided to use the .every method. However, all results are returnin ...

The React engine is triggering an error stating "Module not found."

Utilizing react-engine to enable the server with react component access. Through react-engine, you can provide an express react by directing a URL and utilizing res.render. The documentation specifies that you need to supply a path through req.url. app.use ...

I need assistance with utilizing the removeMarker function in GMaps.js to effectively sort and filter markers

Currently, I am using GMaps.js for my project. I have successfully added markers via JSON and now I'm looking to filter (hide) certain markers based on specific values within the JSON data. For instance, I want to hide all markers that do not have a v ...

Design a custom screensaver using jQuery that includes a timed delay feature and an alert message

I am currently working on implementing a screensaver feature for my website. Here is the breakdown of what I am trying to achieve: When detecting the onload, clicks, and touches, I want to start a timer that counts 5 seconds. If any of these events are d ...

What is the best way to retrieve the content of HTML tags from a string using JavaScript or AngularJS?

I have a string with mixed content of HTML tags and text. Here is an example: var str = "<p></p><p><i>blabla</i></p><p><i><b>blaaaaaablaaaaa</b></i></p><iframe src="..." height=" ...

`GatheringformData() fails to retrieve information after adding new information`

The problem here is that the formData object is not appending anything. What should I do to fix this? $('#btnSave').click(function () { var form = $("#myForm"); var formData = new FormData($(form)[0]); ...

Session management functions properly in Postman, however, encountering issues when attempting to use it on a web

Working on a NodeJS project using express-session to handle sessions. When sending a post request to http://localhost:5500/login, a session is created with an additional property userid. Upon making a get request to http://localhost:5500/ using Postman, th ...

Clicking "Submit" button in JQuery dialog does not activate the __doPostBack function

I am facing an issue with a textbox in a JQuery popup dialog. The Keypress event on the textbox is functioning correctly and only captures the enter key. However, I am trying to trigger __doPostBack on the enter key of the textbox but have been unsuccessfu ...

There is no way to avoid a PHP variable being displayed in a JavaScript alert box

It may sound silly, but I've spent hours trying to escape this PHP variable that contains post data: $post=array ( 'offers' => '90', 'pn' => '2', 'ord' => 'price', 'category_s ...

Activate or deactivate a button depending on the input value of a TextField in React.js

I am currently designing a form similar to the one displayed in this image. I want the "Add" button to become active as soon as the user starts typing in the "Tags" input field. For this project, I am using material-ui and I have created an Input compone ...

Accessing WCF REST endpoint using Ajax and transmitting data in JSON format

I have developed a Rest service in WCF (demo), which provides me with the following output: {"GetEmployeeJSONResult":{"Id":101,"Name":"Sumanth","Salary":5000}} Now, I have created an ASP.NET website where I am utilizing AJAX JSON to call this rest service ...

Issue with Prettier AutoFormatting in a project that combines TypeScript and JavaScript codebases

Recently, I've started incorporating TypeScript into an existing JavaScript project. The project is quite large, so I've decided to transition it to TypeScript gradually. Below is a snippet from my eslintrc.js file: module.exports = { parser: ...

Deactivating Node.js files in vsCode for client-side JavaScript files

I'm facing a major challenge when it comes to coding with JavaScript. I have a JavaScript file that is using Node.js, which means I am unable to manipulate the DOM elements. Take this code snippet for example: var form = document.getElementsByClassNa ...

PHP working with Ajax, receiving a status of 200 but still showing a readyState of 0

Snippet: function handleXMLHttpRequest() { var xhr; try { xhr = new XMLHttpRequest(); } catch (e) { try { alert("Error occurred"); xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ x ...

No search results found for Mongoose text search query

Despite using Mongoose 5.7.8 for my app, the text search feature is not yielding any results. Below is a schema/model example: import mongoose, { Document, Schema } from 'mongoose'; import { Moment } from 'moment'; import { IUser } fr ...

Retrieve the value of an input text within a table data cell using JavaScript

I have set up a table using CGridView, which includes input text fields for user input. The problem I'm facing is that I can retrieve the text from table cells without input fields, but not from those containing input fields. PHP: <?php $this-> ...

Navigating the component class in Angular to access the values of an observable object

When I send an object with two values - an array and a simple variable - it is received in another component using observable. From there, I access the object values directly in the HTML template file. Below is the code snippet: Home Component: // Home ...