Isotope animation glitches causing malfunction

I've been experimenting with CSS3 transitions on isotope items, but I'm encountering some strange behavior. My goal is to achieve a fading effect on the items, similar to this example: . Thank you in advance!

Here's what I have so far: http://codepen.io/GranitS/pen/VYmNdJ

<div id="filters" class="button-group">
<button class="button is-checked" data-filter="" id="all-filter">All</button>
<button class="button" data-filter=".one">One</button>
<button class="button" data-filter=".two">Two</button>
<button class="button" data-filter=".three">Three</button>
</div>
<div class="isotope">
<div class="item one"> 1 </div>
<div class="item two"> 2 </div>
<div class="item three"> 3 </div>
<div class="item four"> 4 </div>
</div>

CSS:

.item{
width:50px; height:50px;
background-color:red;
float:left;
padding:20px;
margin:20px;
}

.isotope,
.isotope .item {
  /* change duration value to whatever you like */
  -webkit-transition-duration: 0.8s;
     -moz-transition-duration: 0.8s;
   -ms-transition-duration: 0.8s;
   -o-transition-duration: 0.8s;
      transition-duration: 0.8s;
}

.isotope {
-webkit-transition-property: height, width;
 -moz-transition-property: height, width;
  -ms-transition-property: height, width;
   -o-transition-property: height, width;
      transition-property: height, width;
}

.isotope .item {
-webkit-transition-property: -webkit-transform, opacity;
 -moz-transition-property:    -moz-transform, opacity;
  -ms-transition-property:     -ms-transform, opacity;
   -o-transition-property:      -o-transform, opacity;
      transition-property:         transform, opacity;
}

Answer №1

It's not recommended to use CSS to manipulate Isotope effects since this can lead to conflicts with Isotope's transitions, resulting in unexpected outcomes. Instead of styling the .isotope class directly, consider utilizing the visibleStyle, hiddenStyle, and transitionDuration options when setting up Isotope.

var isotope = new Isotope( '.isotope', {
    itemSelector: '.item',
    layoutMode: 'fitRows',
    hiddenStyle: {
      opacity: 0
      /* , transform: 'scale(0.001)' -- scaling disabled */
    },
    visibleStyle: {
      opacity: 1
      /* , transform: 'scale(1)' -- scaling disabled */
    },
    transitionDuration: '0.8s'
});

For more information on these options, refer to the Isotope options page.

Check out this CodePen example showcasing these changes.

UPDATE:

Although Isotope doesn't offer a built-in option to exclusively disable position transitions (you can disable all transitions by setting transitionDuration to 0 or using the undocumented isLayoutInstant: true option), you can override the _positionItem function to achieve the desired behavior. Simply insert the following code snippet at the start of your JavaScript:

var positionFunction = Isotope.prototype._positionItem;
Isotope.prototype._positionItem = function( item, x, y, isInstant ) {
  // pass `true` to the original function regardless of the actual isInstant value;
  positionFunction(item, x, y, true);
};

View an updated version of the CodePen with this modification here.

Answer №2

Here's a different approach to manage animations without interfering with other elements. By targeting the transition property specifically, you can control how animations are applied. Try adjusting the code snippet below:

.isotope .item {
  transition-property: opacity !important;
}

If you want to experiment further, feel free to check out this modified version on your own: http://codepen.io/anon/pen/myOYeE

You may also incorporate @markegli's suggestion to enhance the fading effect:

hiddenStyle: { opacity: 0 },
visibleStyle: { opacity: 1 }

Answer №3

Is it possible to simply exclude this section from the CSS?

.isotope,
.isotope .item {
  /* Modify duration value as needed */
  -webkit-transition-duration: 0.8s;
 -moz-transition-duration: 0.8s;
  -ms-transition-duration: 0.8s;
   -o-transition-duration: 0.8s;
      transition-duration: 0.8s;
}

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

Setting the default date in angular-bootstrap-datetimepicker: a step-by-step guide

I am currently utilizing the angular-bootstrap-datetimepicker module for allowing users to choose a date and time. How can I set a default date and time when the view initially renders? Is there an attribute available that allows us to assign a boolean val ...

Using jQuery to send an Ajax request to a Web Method

I am encountering an issue when trying to send data to my code behind method. Everything works perfectly fine until I add something to the data parameter. function (obj) { $.ajax({ type: "POST", url: "Pages.aspx/EditPage", data: "{ ...

I'm experiencing an issue where a function call within a Vue.js v-for directive causes the loop to continue indefinitely, but I'm unsure of the cause

Here is the template I am working with: <template> <div> <div v-for="report in reports"> <div class="map" v-bind:id="mapID = report.started.toUpperCase()" v-text="report.started"> {{hello(mapID)}} </div& ...

Choose value using jQuery option

How can I locate and select an option within a select element using its value? The select input is already a jQuery object. Here is the snippet of code I have written: my_select.filter("option[value='2']").attr('selected', "selected"); ...

Ways to adjust the width of the Dialog box in Jquery UI to 60% of the window size

Currently, I am utilizing Jquery UI for a pop-up feature that displays a table populated through an Ajax call. The script implementation is as follows: <script> $(function() { $( "#dialog" ).dialog({ autoOpen: false, show: { ...

The JavaScript code runs first before retrieving any information from the server

When it comes to validating coupons on Stripe, the process needs to be done on the server side rather than the client side. I've tackled this by writing some code for validation, but I'm facing challenges with synchronizing the AJAX/JSON response ...

What's the best way to position menu items vertically in a navbar?

I've been struggling to vertically center the menu items "TEST 1","TEST 2" and "BRAND" within the navigation bar without any luck. I've experimented with vertical-align, margin-top, and bottom properties. What I'm aiming for is to have them ...

Click on all the links in the array to open them in separate tabs

I currently have an array that looks like this: myArray = ["", ""] The issue I am facing is that when trying to open them all in separate tabs, the code I'm using concatenates all the URLs together and attempts to open them as one. If anyone has a ...

contrasting module export approaches

Let me clarify that my query does not revolve around the disparity between module.exports and exports. Instead, I am interested in understanding the contrast between exporting a function that generates an object containing the functions to be shared upon i ...

Customizing table headers in Yajra Laravel Datatables

I am encountering an issue with category sorting on my list of products. When I click on category sorting, it only shows the same category and product name repeatedly. All other sorting functions are working correctly, except for category sorting. I have ...

Ensure that both Vue methods are executed synchronously

I am working with two Vue methods: (1) this.retrieveSavedSearches() (2) this.updateDefaultSelectOption() Is there a way to ensure that method (2) only executes after method(1) has completed its execution? ...

Grails project: Attempting implementation of tablesorter

I have a question regarding utilizing table sorter with my Grails project. I have successfully copied the jquery.tablesorter.js file into the 'js' directory, allowing me to make columns sortable on click. However, I am curious about accessing the ...

Two divs positioned to the right on top of each other

I want to align two divs on the right side of their parent div, one above the other. Here's a visual representation: div#top |-------------------------------------||------------| |div#parent ||div#menu | | ...

On Linux systems, Node.js in JavaScript interprets strings as objects only

I'm encountering an issue with my Discord.io bot. I am attempting to run it on a Linux server, but the Linux version of Node.js keeps treating the contents of a string as a separate object, leading to the following TypeError: TypeError: Object IT&apo ...

Attempting to download an image through an axios fetch call

There is an issue I am facing while trying to retrieve an image from the website www.thispersondoesnotexit.com. function getImage() { axios({ method: 'get', url: 'https://www.thispersondoesnotexist.com/image' }) ...

Can the Route be modified in Next.js?

I have developed search functionality that navigates to "/search/xxxx", but it is located in the header. Every time I perform a search, the route gets repeated and becomes "/search/search/xxx". Could you suggest any way other than usin ...

Animate the chosen text via specialized effects

I am trying to implement a show/hide feature for specific text using jQuery. The challenge I am facing is having multiple instances of the same text tag with identical ids. I want to trigger the animation on a particular child element when hovering over it ...

Using JavaScript, add a complex JSON record to a JSON variable by pushing it

I have been attempting to insert a complex JSON data record into a JSON variable using the following code: var marks=[]; var studentData="student1":[{ "term1":[ {"LifeSkills":[{"obtained":"17","grade":"A","gp":"5"}]}, {"Work":[{"obtained":"13"," ...

Utilizing the HTML button element within an ASP file combined with JavaScript can lead to the reloading of the

I am attempting to create a JavaScript function for an HTML button element. However, I have noticed that it causes the page to reload. Strangely, when I use an input with a button type, everything works perfectly. What could be causing this issue and why a ...

Issues encountered when executing unit tests using karma

I encountered these issues in the logs. Seeking advice on how to proceed. Thank you. I've attempted uninstalling and reinstalling phantomjs, clearing out my node modules and bower component directories. Everything was functioning as expected before, a ...