Animation for Images in Angular v1.2

After reviewing tutorials and previous questions, I have been trying to pinpoint where my code is going wrong in applying an animation to transition between the images I want to display.

The ng-show function effectively displays the selected picture, but the image transitions are not picking up the effects I am trying to apply.

<!-- Image Buttons -->
<div class="content">
  <div ng-repeat='image in images' class="{{image.cls}}" 
  ng-click="showThis($index)" value="{{image.set}}">
    <label>{{image.title}}</label>
  </div>
</div>

<!-- Display Image -->
<div id="imgHolder" ng-view class="slidedown">
    <img ng-repeat="image in images" ng-src="{{image.url}}" 
    alt="{{image.id}}" ng-show="nowShowing==$index">
</div>

I am aware that displaying the images using the same ng-repeat may be a solution; however, adjustments to the CSS will be necessary for that to happen, which I plan to address later on.

Below is the .slidedown section, containing the animation CSS:

.slidedown {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.slidedown.ng-enter,
.slidedown.ng-leave {
  -webkit-transition: all 1s ease;
  -moz-transition: all 1s ease;
  -o-transition: all 1s ease;
  transition: all 1s ease;
}
.slidedown.ng-enter {
  opacity: 0;
}
.slidedown.ng-enter-active {
  opacity: 1;
}
.slidedown.ng-leave {
  opacity: 1;
}
.slidedown.ng-leave-active {
  opacity: 1;
}

If anyone has any tips, suggestions, or guidance on how to proceed, it would be greatly appreciated.

Answer №1

Instead of putting the class "slidedown" on the div, just apply it to the image itself.

<div id="imgHolder" ng-view>
    <img ng-repeat="image in images" ng-src="{{image.url}}"  class="slidedown" 
    alt="{{image.id}}" ng-show="nowShowing==$index">
</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

Invisibility Problem

As a newcomer to web design, this is only the second website I have ever created. However, I am facing an issue with my Nav bar that I cannot seem to resolve. I want my "Other Pages" section to be visible when the screen size is below 600px and hidden when ...

I recently utilized Bootstrap to create a responsive website, but I've encountered an issue where the space between columns has disappeared. Any suggestions on how to rect

I noticed that when I applied Bootstrap, the flexibility between boxes disappeared. I want to achieve a layout similar to image 2 and also add spaces between the boxes or div elements. .alignboxes{ padding-top:40px; display: flex; justify-co ...

Organizing Vue.js components into separate files for a cleaner view model architecture

Having smooth functionality in a single file, I encountered difficulties when attempting to break up the code into multiple files and bundle it in a .vue file. Below is the final .vue file for simplicity. Here is the HTML file: <!DOCTYPE html> < ...

In React using Flow Type, the syntax [...mySet] doesn't function as expected, while Array.from(mySet) successfully converts the

Why is it that with React and Flow Type, the line of code displaying [{}] when using JSON.stringify([...mySet]) but shows the correct values with JSON.stringify(Array.from(mySet))? The issue seems perplexing as this behavior cannot b ...

Tips for submitting a form with multiple fields that share the same name attribute using ajax:

I have created an HTML form <html> <head></head> <form> <input type="text" name="question[]" /> <input type="text" name="question[]" /> <input type="file" name="image" /> <input type="submit ...

Using target="_blank" does not seem to open a popup window in React

The issue is that the target="_blank" attribute is not working properly for the modal popup window. Instead, the link is opening in the same page and the popup is closing. <TermLink to="/legal/privacy-policy" target="_blank"> Privacy Pol ...

Using a comma format while typing in Angular ensures that the input field

When using jqxwidget from here, the default format includes commas separated by underscores. I am looking to have the field empty initially, with commas appearing as the user types - similar to a F2 cell renderer. For example, typing 100 should display a ...

Ways to retrieve the React Router match object in mapStateToProps

Is there a way to access the react-router match object for its params from mapStateToProps or any other selector? I'd like to use these params to generate a value that will be passed down as props to a presentational component within the selector. The ...

What are the steps to utilize WebRTC in transmitting a real-time webcam feed from the user interface to the server?

Currently, I am in the process of developing a simple Streamyard alternative that can capture live webcam streams from users' browsers and transmit them to the backend for further processing and conversion into the necessary format for streaming on pl ...

The PDF file appeared blank after receiving a response from the API using Node.js

When I call a REST API that returns a PDF file, the document appears blank when opened. The console indicates that the data may be corrupted. let url ="API-URL"; var options = { 'method': 'GET', 'url': url ...

Unable to import a Module in React without curly braces, even when using 'export default'

I recently stumbled upon a question regarding module imports in React. Some sources mentioned that using curly braces around imports can increase the bundle size by importing the entire library. However, I had been successfully importing modules without cu ...

Creating a specialized .toString() function for an array

When trying to create a custom .toString() method on the Array prototype, how can you access the actual array that the method is called on? This approach seems to work: Array.prototype.toString = () => 'custom'; "" + [1,2,3]; // 'custom ...

Single parallax movement determined by the position of the mouse cursor, with no margins

Recently came across this interesting code snippet [http://jsfiddle.net/X7UwG/][1]. It displays a parallax effect when moving the mouse to the left, but unfortunately shows a white space when moving to the right. Is there a way to achieve a seamless single ...

Add a CSS class to a different element when hovering

I have the following HTML structure: <div class="container"> <div class="list-wrapper"> <ul> <li class="item-first"> </li> </ul> </div> <div class="description-wrapper"> <d ...

Modify the starting URL in a Node.js application to /foo instead of just /

I am looking to visit a website with a default index URL like localhost:XXXX/foo, instead of the usual localhost:XXXX/. How can I achieve this specific setup? Any suggestions on how to make this happen? ...

Seeking a material design template for mandatory form patterns

I'm struggling with getting my required field patterns to work using regular expressions. Additionally, I'd like to center my 'onboard' button on the page. You can find my code at this StackBlitz link: https://stackblitz.com/edit/angula ...

What could be causing Chrome to reduce the display size in responsive mode?

My website is designed to be responsive and includes a viewport tag for mobile devices, as shown below: <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> How ...

Using React for form validation

I'm facing a challenge while trying to develop a user registration form, especially when it comes to displaying form validation errors. Issues: 1) The input fails to post (via axios) to the database upon submission for inputs without errors. 2) The e ...

Content will be loaded only after the user clicks on the item

On my blog, I have a share button that displays different social media platforms when clicked. However, the page takes longer to load due to fetching data from multiple servers like Facebook and Twitter. Is there a way to use jQuery to make these buttons l ...

Obtaining a parameter from @PathVariable in an AngularJS controller

Recently, I have acquired knowledge about Angular.js. I am experimenting with using Angularjs to bind an object with a form. I have a scenario where there is a list of items and when a user clicks on one, the app navigates to a Spring controller: @Request ...