Switching out an element within a constrained array causes a momentary disappearance of the item

My playlist features artwork images that can be clicked. Upon clicking an image, the current track is replaced by the new selection in the array.

An issue arises when Ember re-renders the items, causing a brief moment where the replaced element disappears and everything shifts positions, resulting in an unappealing effect.

To see this effect firsthand, visit

  • Go to
  • Click on one of the three playlist-images

This is my simplified controller:

import Ember from 'ember';

export default Ember.ArrayController.extend({

  playlist: null,
  currentTrack: null;
  actions: {
    replaceItem: function(){
      playlist.replace(index, 1, [self.get("currentTrack")])
    } 
  }
}

This is the template:

{{#each song in playlist}}
  <div class="song" {{action "changeTrack" song}}>
    <img {{bind-attr src=song.artwork_url}} />
  </div>
{{/each}}

EDIT: Despite creating a JSFiddle, I could NOT reproduce the problem using plain jQuery http://jsfiddle.net/bhn8bko1/2/

Answer №1

Upon observation, it appears that the selected playlist smoothly transitions by moving over and gradually fading to transparency before becoming visible as the current playlist. This fade out effect allows the old playlist to still be partially seen behind it before quickly switching. To eliminate this abrupt switch, one could have the new playlist scale back down to its original size instead of fading out completely. By maintaining opacity while decreasing in size, the transition could occur seamlessly without any sudden movements.

Although the old playlist may still seemingly "jump-appear" on the right, this visual disruption could potentially be minimized with a gentle fade-in effect.

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

Incorporate a JSON file into the Webpack output separately from the bundle.js file

Is there a way for my webpack application to read a JSON file at runtime without including it in the bundle.js after packaging? I want the JSON file to be available in the package folder but not bundled with the rest of the code. How can I achieve this? ...

What is the method to ensure that flexbox takes into account padding when making calculations?

There are two sets of rows displayed below. The first row contains two items with a flex value of 1 and one item with a flex value of 2. The second row contains two items with a flex value of 1. As per the specification, 1A + 1B = 2A However, when ...

CSS - Issue with dropdown sub-menu alignment despite using absolute positioning in relation to parent button

Title fairly explains it all. I'm having trouble getting my dropdown submenus to align perfectly with the bottom of the parent list item element. The list item has a relative position, while the submenu has an absolute position. I've attempted ...

"Transforming the Website Background with a Splash of Color

I am trying to figure out how to change the color scheme of my website with a button click. Currently, when I select a different color, only the background of the webpage I'm on changes, not the entire website. I have applied CSS but it's not ref ...

Swap a jQuery class with another if the class for ul li is currently active

I am currently developing a form builder and I would like to customize the appearance, specifically changing the color of the text. I want the text to be white when the class is set to active, and black when the class is not active. Is there a way to achi ...

Deactivating one div's class upon clicking on another div

Below is the HTML code snippet: <div class="container"> <ul class="navbar"> <li class="nb-link"><a>Home</a></li> <li class="dropdown"> <a>CBSE</a> <ul class="dropdown-menu"&g ...

Maintaining consistent div height in Bootstrap 4 flexbox design

I'm currently using Bootstrap 4 with flexbox enabled, but I'm having trouble making the row > col > div boxes have equal heights. I attempted to use position: absolute, but it's not the ideal solution. Below is a screenshot of the is ...

Is there a way to consistently maintain a specific column size in Bootstrap?

I'm currently working on a website and running into an issue that I can't seem to resolve. The problem lies in the layout of multiple cards with information; they are arranged in columns and when there are more than 4 columns, they switch to a ne ...

I keep receiving unexpected security alerts in Firefox without any specific cause

After making some updates to my page, I started receiving a security warning. The data you've entered may be at risk as it is being sent over an insecure connection that could potentially be intercepted by a third party. I'm puzzled because m ...

What is the best way to prevent images from being loaded with broken links?

Currently, I am working on a new feature that involves rendering images from servers. In the process of aligning these images, I noticed an excessive amount of white space due to loading images with broken links. https://i.stack.imgur.com/jO8BR.png Here ...

There is no class present in the @Apply layer with Tailwind styling

I've been searching for what seems like a simple solution, but I can't seem to find it. While researching similar issues, I noticed that people were having problems with the Hover style and extra white space after it, which is not the issue in my ...

I am encountering a WordPress database error while trying to send data with my post request

I am encountering an issue while attempting to utilize an ajax post request to retrieve data from my database. I am struggling to properly send the necessary data, specifically the country name, to my ajax hook. Here is my JavaScript code: $.ajax({ ...

Animation will begin once the page has finished loading

On the website, there is a master page along with several content pages. The desired effect is to have a fade-in animation when navigating between pages. Currently, when clicking on a link, the new page appears first and then starts fading out, but this sh ...

Unexpected Results from Div Positioning

Here is the PHP code snippet I am working on: <?php include 'header-adminpanel.php'; ?> <div class="container"> <div class="body-content"> <div class="side-left"><?php include 'adminproduct_sidebar.ph ...

Steps to place a URL and Buttons over an existing header Image

1) I am working with a header JPEG image that is 996px wide and includes a square logo on the left side. My goal is to use only this square logo section and add an href tag so that when users hover over it, the cursor changes to a hand pointer and they are ...

Tips for maintaining the dropdown selection when new rows or columns are added to a table

I have a task requirement where I must generate a dynamic table using jQuery. I've successfully implemented adding dynamic columns or rows to the table. Feel free to check out the fiddle code here. HTML: <div id='input_div' name='i ...

The only functioning href link is the last one

Currently, I am in the process of constructing a website using HTML and CSS. My goal is to create a white rectangle that contains 4 images, each serving as a clickable link redirecting users to different sections on the page. The issue I am facing is that ...

Updating input values dynamically using AJAX in Laravel 6

Having an issue with filling Input after selection in a Dropdown. The database contains contact details. On the form, there is a Dropdown displaying names of people that should populate the fields with data on click. Using Ajax with Jquery for this purpose ...

When it comes to Shopify Schema, the section settings are functional within the <style> tag, whereas the block settings do not seem to have the same

While working on updating a section with multiple blocks, I encountered an unusual issue. My goal was to incorporate a new block into an existing section. The schema has been set up correctly, and everything is functioning as anticipated. However, the prob ...

issues with padding in the main content section

When I try to search for something that isn't on the page, a strange margin or padding issue occurs. I have thoroughly reviewed the code but can't seem to pinpoint the problem. The unwanted 30pxish margin after the footer should not be present wi ...