Looking for help positioning arrows in HTML/JS for a pop-up gallery

Currently, I am working on developing a Flask application that displays a list of videos fetched from a database in an HTML template. Upon clicking a video link, the video opens and plays in a pop-up window with arrow buttons for navigating to the next or previous video, and a close button to exit the pop-up window.

Below is a snippet of my Jinja2 template along with the corresponding JavaScript code:

{% extends "base_nav2.html" %}
{% block content %}
    <div id="works">
    <div class="container">
    {% if results %}
        <center><h2>Results for Query: {{ query }}</h2></center>
        <div class="row text-center page" style="display:flex; flex-wrap:wrap;">
        {% for p in results %}
            <div class="col-md-3 col-sm-6">
                <div class="thumbnail" style="height: 162; width: 284">
                    <img src="{{ url_for('static', filename=p.thumb) }}">
                    <div class="caption">
                        <a href="#media-popup" data-media="{{ url_for('static', filename=p.path) }}">{{p.filename}}</a><br>
                    </div>
                </div>
            </div>
        {% endfor %}
        <div class="popup" id="media-popup">
            <a href="#media-close" id="media-prev" style="margin-top: -10;"><i class="fa fa-arrow-left fa-4x" style="margin-top: -10;"></i></a>
            <a href="#media-close" id="close" align="right"><i class="fa fa-window-close fa-4x" aria-hidden="true"></i></a>
            <a href="#media-close" id="media-next"><i class="fa fa-arrow-right fa-4x"></i></a>
        </div>
        </div>
    {% else %}
        <center><h2>No results found for Query: {{ query }}</h2></center>
    {% endif %}
    <div>
    </div>

    <script>
    // JavaScript code for video pop-up functionality goes here
    </script>
{% endblock %}

CSS:

.page {
    position: relative;
    height: 100%;
}

.popup {
    position: absolute;
    z-index: 2;
    margin-top: 10;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    visibility: hidden;
    transition: 0.3s ease;
}

.show-popup .popup {
    opacity: 1;
    visibility: visible;
}

Preview of the video pop-up design

I am seeking advice on how to position the arrow buttons next to the player and the close button in the corner of the shaded area. I have tried different strategies without success. Can you recommend the best approach to achieve this layout?

Answer №1

Would you be interested in implementing something similar to this design? I have included positioning attributes for the buttons.

.notification {
  position: absolute;
  z-index: 2;
  margin-top: 10;
  top: 0;
  left: 0;
  width: 400px;
  height: 400px;
  background: rgba(0, 0, 0, 0.7);
  transition: .3s ease;
}

#close {
  position: absolute;
  right: 0;
  top: 0;
}

#prev {
  position: absolute;
  left: 0;
  top: 35%;
}

#next {
  position: absolute;
  right: 0;
  top: 35%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet"/>
<div class="notification" id="popup">
  <a href="#close" id="prev" style="margin-top: -10;"><i class="fa fa-arrow-left fa-4x" style="margin-top: -10;"></i></a>
  <a href="#close" id="close" align="right"><i class="fa fa-window-close fa-4x" aria-hidden="true"></i></a>
  <a href="#close" id="next"><i class="fa fa-arrow-right fa-4x"></i></a>
</div>

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

Using JavaScript to extract variables from parsed JSON data

Could someone please help me understand how to run this code smoothly without encountering any errors? var test = 'Something'; JSON.parse('{"xxx": test}'); I am inquiring about this because I have a JSON object containing variables th ...

Retrieve the Checked Value of a Checkbox Using Ajax Post in MVC

Can anyone provide assistance? This is the code I am working with: Index.cshtml <!DOCTYPE html> <html> <head> <title>jQuery With Example</title> @Scripts.Render("~/bundles/jquery") <script type="text/javascri ...

The execution of the code may encounter errors initially, but it generally runs without any issues on subsequent attempts

I recently developed a piece of code to ascertain whether a value in the database is null or not. Here's the snippet: var table; var active = false; function CheckActive(table){ this.table = "table" + table + ""; var db = window.openDatabas ...

Is it possible to incorporate vector graphics/icons by simply adding a class to a span element in HTML5?

In order to add a glyphicon icon to our webpage, we simply need to include its class within a span element, as demonstrated here: <span class="glyphicon glyphicon-search"></span> We also have a few files in .ai format that can be converted to ...

SQL query for finding the number of shared nodes between two given nodes

How can we determine the common nodes between two specific nodes in SQL, using the following example: Count the occurrences of <li> tags between <h2 id="vgn">VGN A </h2> and <h2 id="vgn">VGN </h2>, as well as the total number ...

Exploring VueJs 3's Composition API with Jest: Testing the emission of input component events

I need help testing the event emitting functionality of a VueJs 3 input component. Below is my current code: TextInput <template> <input v-model="input" /> </template> <script> import { watch } from '@vue/composition-api&ap ...

The console.log() displays the dictionary correctly, but trying to access it with a key results in it being undefined

I'm currently facing an issue with accessing the dictionary stored in the "workload" field of a document in Firestore. Here is the snippet of code I am struggling with: async addTask() { const projectDoc = await getDoc(doc(db, "projects", "Testing ...

How can I shift the button's location within a pop-up in Ionic 1?

enter image description here I am struggling to make the button green underneath the three other buttons. Can someone please assist me with this? Here is my code: $scope.showIntroductionPage = function(childs){ if(childs == 0){ var myPopup = $io ...

Locate the final flexbox in the initial row and the initial flexbox in the concluding row

How can I identify the last element of the first row and the first element of the last row in the given code to make it round from all corners? It should be noted that the column number will vary as well as the last element of the first row and first eleme ...

In-line Vertical Ticker Display

I attempted to use vTicker, but I found that it does not function properly when used as an inline element. <h1> <div id="vticker"><ul>...</ul></div> Some other headline text </h1> My goal is to have the vertica ...

What methods are most effective for showcasing Flash messages within Express.js?

I have a Node.js app in the EJS framework and I am new to JavaScript. Could someone please advise me on the correct way to set flash messages in Node.js? Below is my code which is throwing an error: C:\Users\sad\Desktop\Node Applica ...

Vuejs dropdown selections are not working as expected due to a bug

My dropdown menu is being populated with options based on an API response that looks like the following: {"value":"1371","label":"apple"},{"value":"1371","label":"banana"},{&qu ...

Deleting list items by clicking a button

I'm working on adding a functional "x" button to each list item (li) so that users can click on it to remove the item. I've successfully added the button, but I'm unsure about what code to use in the onClick event to delete the corresponding ...

Steer clear of using the onRowClick event if an outputLink is clicked within a RichFaces datatable

What is the best way to prevent the call to onRowClick on a column with an output link in a datatable that targets a new window? <rich:dataTable id="dt" value="#{bean.cars} var="_car"> <a:support event="onRowCli ...

What sets apart .js and .ts files in the development of a Selenium Protractor framework?

As a newcomer to Selenium Protractor, I noticed that many tutorial videos on YouTube utilize .js files for test scripts. However, the framework in my current project utilizes .ts files instead. I am seeking assistance in comprehending the variances betwe ...

Using Javascript, when the command key is pressed, open the link in a new window

Currently, I am working on a Javascript function that opens links in a new tab only when the "command" key is pressed on an Apple computer. Here is what I have so far: $(document).on('click','a[data-id]',function(e){ if(e.ctrlKey|| ...

What is the best approach to developing Vue components with unique templates while maintaining the same functionality without duplicating code?

I am working on a project to develop a custom and versatile datatable component. My goal is to be able to adjust the appearance of the datatable on each page, while maintaining consistent functionality. I want to pass data rows into the component and have ...

Unable to resize react-split-pane dimensions

I recently integrated the react-split-pane plugin into my project, but I am encountering some issues with its functionality. Even though I have tested react-split-pane versions 0.1.68, 0.1.66, and 0.1.64, none of them seem to work as expected in my applic ...

What is the best way to link and store invoice formset with the main form foreign key in Django?

I am new to Django and need help. I am trying to save my invoice in a database, but the issue I'm facing is that I can't retrieve the foreign key from the main form when I try to save the formset. View.py def createInvoice(request):` if requ ...

webgl renderer for cytoscape.js

I have been exploring different layout extensions and have examined various examples from existing extensions like arbor, cola, cose-bilkent, as well as the scaffolding provided here. However, I am facing a roadblock when it comes to integrating a webGL re ...