Interactive image showcase that flips on click to reveal accompanying text descriptions

I'm excited about creating a photo album/gallery for my family as my first project. I've made great progress so far - the layout is responsive, and each photo can flip individually. The only roadblock I'm facing is adding a back to the photos displaying some text (like the date taken or a small description).

Below is the code I've written up to this point. Any feedback would be greatly appreciated:

[written code examples go here]

Answer №1

I've made some adjustments to your code for better clarity and functionality.

To streamline the code, I removed non-essential elements like titles, videos, and most images unrelated to the Y-axis flipping problem.

For demonstration purposes, I utilized placeholder.com's image placeholders of varying resolutions.

The structure of the elements was altered significantly. Here is a snippet comparing the old and new versions:

  <div class="album">
    <img class="album-photos" src="Images/Photos/pic1.jpg" onclick="flip(this)">
    ...
  </div>

was transformed into this:

      <div class="album">
        <div class="imgContainer">
          <div class="imgHolder" onclick="flip(this)">
            <img class="album-photos" src="https://via.placeholder.com/350x650">
            <div class="infoHolder flipped"&rt;Lorem ipsum<br&rt;2022-12-20</div>
          </div>
        </div>
        .....
     </div>

This rearrangement allows for maintaining existing CSS while introducing a simulated 'back' to the images using div.infoHolder.

Furthermore, the JavaScript was updated to handle toggling the .flipped class for both the image and its corresponding information container simultaneously.

While the example provided may not be perfect, it serves as a good starting point for implementing similar functionality in your project.

Refer to this Stack Overflow answer for a more advanced illustration of image flipping on hover.

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

What is the best way to respond to a hashchange event within AngularJs?

I am new to AngularJs and I am trying to update the page on hashchange events. Currently, I have this code which I know is not the proper way to do it: <!DOCTYPE html> <html> <head> <style> #hashdrop { display:block; ...

Is it safe to remove the `async` keyword if there are no `await` statements in use

Forgive me if this is a silly question, but I'm considering removing the async function below since there are no await's. This code is part of a large production system, and I'm unsure if removing async could have unexpected consequences? (a ...

How can I retrieve an array of collections from multiple parent documents in Firebase and pass them as props in Next.js?

I need to access all the collections within the documents stored in a collection named users. This is how I currently retrieve all the user information: export async function getServerSideProps() { const snapshot = await firebase .firestore() .collection ...

After downloading the latest version of NodeJS, why am I seeing this error when trying to create a new React app using npx?

After updating to a newer version of NodeJS, I attempted to create a new React app using the command npx create-react-app my-app. However, I encountered the following error message: Try the new cross-platform PowerShell https://aka.ms/pscore6 PS E:\A ...

Converting JSON data to HTML using Handlebars

Can you assist me in transforming the following JSON data into a table with 3 columns: property name, property source, and property value? "result": { "total": 100, "config": { "propName1": { "source": "propsrc1", ...

angular state transitions automatically following successful ng-file-upload with no apparent cause for error

After successfully uploading a file to the server, my AngularJS application redirects me back to the initial state without any errors. The success callback is triggered and there are no errors reported. Using ng-fileupload version 3.2.5. This is the fun ...

Execute a sudo command using an html button

Looking for a way to create a simple website with HTML buttons on my Raspberry Pi that can execute sudo commands. I attempted the following method: <?php if (isset($_POST['button'])) { exec('sudo reboot'); } ?> ...

The essence of space remains intact within my front-end content

Here is the JavaScript code snippet I am using for keyHandler on the front-end: let snippet = document.getElementById('snippet'); let remaining = document.getElementById('remaining'); let typed = document.getElementById('typed&ap ...

CSS PopUp positioning

Can anyone help me with applying the position top and bottom of header to the NewUser div? I've tried but it's not working. How can I add !important; to the CSS? Maybe something like $("header")!important} <div id="divNewUser" class="CreateUs ...

Are moment.js and moment.php interchangeable?

Recently, I developed a JavaScript script utilizing moment.js and I am looking to mirror it using a cron job in PHP. In my search for moment.js equivalents in PHP, I came across this https://github.com/fightbulc/moment.php ...

The ng-change event is triggered for radio buttons that are generated using ng-repeat the first time they appear, but not for subsequent appearances

Is it possible to trigger the updateRow method on every change of a radio button selection? Currently, the updateRow method is only being called the first time the radio button changes. How can I make sure it executes each time there is a change? Html: ...

What is the best way to substitute one element with a different one?

Here is my HTML snippet: <html> <head></head> <javascript> var item = document.getElementById('demo'); console.log(item); var myList = document.getElementsByClassName('myClass'); ...

Positioning a div relative to another div using the pos:fixed attribute

Is there a way to make a fixed position div relative to its parent div instead of the window using only CSS? I want a sticky block that follows the content while scrolling with the page, and stays in place even when the window is resized. I know this can ...

Preventing the flipping effect with jquery flippy

Hey there! I've been using a cool flippy jquery plugin that I found on this website. It's working great, but I have run into an issue. When the element flips, I want to include a button on the flip side that takes the user to a different page. T ...

Extensive titles disrupt the layout of a grid on smaller screens that adapt to different devices

My approach to creating a responsive grid involves using clean CSS. You can check out the example here: https://tympanus.net/codrops/2013/04/17/responsive-full-width-grid/ While this method works well for displaying gallery images with fixed-width titles, ...

Creating GraphQL fragments dynamically from an array

After reviewing other responses, it appears that the suggested method for constructing dynamic queries is to utilize fragments in the following manner: const series1Q = gql` fragment series1 on timeseriesDataQuery { series1: timeseriesData(sourceId: ...

Server experiencing problem with image uploads

Need Assistance with the Following Issue: Here is the code snippet in ASPX: <input type="Button" id="BtnUpload" class="button1" value="Upload Image" onclick="clickFileUpload();" /> JavaScript function on the ASPX page: function UploadImage(path) ...

What is causing my circles to not align properly in the center?

My website features circles that display various percentages. Each circle contains text indicating the percentage amount, as well as a short description underneath. While I have successfully centered all the text elements, I am facing difficulty centering ...

Encountered an issue while executing the npm run dev command in a React project

Hello, I am a beginner with React.js and I am currently trying to set up a simple React application locally using webpack. However, when I run the npm run dev command, I encounter the following error: An error occurs in the command prompt after running np ...

Is there anyone who can provide a comprehensive explanation for what is going on here?

{ // Let's figure out how to launch my HTML file as a webpage in Chrome. "version": "0.2.0", "configurations": [ { "type": "pwa-chrome", &q ...