Mootools tweening color transition denied for child elements when color is explicitly defined in CSS

Check out this link for testing: http://jsfiddle.net/EnJSM/

You might observe that by removing "color: #6CB5FF;", the transition behaves differently - it only works for the second part of the line.

I'm interested to see what solution you come up with.

Answer №1

A single property, tween is not overloaded, but it should accept either a single argument (target value from current) or an array [value1, value2]. Your code is correct in this regard.

For a different approach, you can try using morph instead:

$("element").addEvent("click", function() {
    this.morph({
        color: ["#A00000", "#99CCFF"]
    });
});

Although tween seems to work fine here as well. When you mention that it's "rejected," what exactly do you mean? Does nothing happen? Do you receive an exception? In which browser? Which version of MooTools are you using? Have you used !important in the CSS? This question is too broad to answer without more specific information.

If you want BOTH elements to change color, you can use the following code:

$("element").set("tween", {
    onStart: function() {
        this.element.addClass("tweening");
    },
    onComplete: function() {
        this.element.removeClass("tweening");
    }


}).addEvent("click", function() {
    $("element").tween('color', ["#A00000", "#99CCFF"]);
});

Also note:

#element.tweening strong {
    color: inherit;
}

This will temporarily disable the styling while you animate.

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

Generate a random 8-digit number with a specific range in JavaScript

I want to generate a random 8-digit number ranging from 0 to 7, excluding the numbers 8 and 9. Here is what I have tried so far, but I'm unable to exclude the numbers 8 and 9: var b = Math.floor(Math.random()*90000000) + 10000000; console.log(b) Is ...

Creating a flash message following a redirect in AngularJS

Just diving into Angular JS and need some clarification. How can I set a flash message after a redirect? Here's my scenario: I have a form where I save data using an HTTP request. Upon success, I navigate to another page using window.location(). Now, ...

Error in syntax: An unexpected token was encountered during an AJAX request

I am currently working on a project that involves looping through multiple JSON files within a directory called "trips" and extracting data from each file to display on the front end of the website. However, I'm encountering a persistent error message ...

Create a custom sorting pipe in Angular 10 that allows for a specific value hierarchy to be passed, without adhering

I am attempting to sort a list of form objects in angular 10 using a custom pipe. The goal is to order them based on a specific property with the following priority: [{VALID: 1}, {INVALID: 2}, {DISABLED: 3}]. I have defined this order as an argument for th ...

Is AjaxMin's EvalTreatment changing the game for JavaScript minification?

While minifying my project using the AjaxMin.dll with the default settings on every build/deployment, I ran into a problem. One of our third-party JavaScript files contains an eval statement that references variables or parameters which, when minified, cau ...

Utilizing REACT to dynamically load multiple HTML elements

Recently, I began developing with React and wanted to load multiple new Input Fields and Labels in a Form using Hooks. However, when clicking the button, only one input field is created using the last value of my array. Upon checking the console, I notic ...

blur event triggered on a cell within a table

Currently, I am using the code snippet below to populate data using a data table. My goal is to be able to edit the data in one of the columns and then validate the value after editing using the onblur event. I attempted to call the onblur event on the t ...

What could be causing my GET route to return an empty array?

I've been attempting to retrieve an event by its id, but for some reason, I'm receiving an empty array as a result in Postman. Below is the code snippet of my route: import { events } from '../../../db.json'; const handler = async (re ...

Converting the length attribute of a table to a string does not yield any

After grappling with this bug for some time now, I've come up empty-handed in my search for a solution online. Expected Outcome: Upon pressing the create row button, I anticipate a new row being added at the bottom of the table. This row should cons ...

Testing a React component's function within the confines of a Redux Provider component

My current challenge involves unit-testing a React component called TodoList. This component essentially maps through items and displays them in the render method. These items, of type TodoItem, are retrieved from the Redux store using MapStateToProps. Be ...

My mobile website, built using Bootstrap, appears as if it is zoomed

I recently launched a website called dekhbehen.com, where users can download wallpapers and generate memes. One issue I have encountered is that when the site is accessed via smartphone, it appears zoomed out. You can visit the specific URL causing this ...

Guide on fetching data from a database using Node Js in a hierarchical structure

I am currently developing a NodeJs backend code to retrieve data from the database. The desired structure of the data should look like this: data = [{ name: "Admin", id: '1', children: [ { name: "Admin", id: "1& ...

Why do I continue to encounter the error message saying 'jQuery is not defined'?

As a newcomer to the world of jQuery and Visual Studio Environment, I embarked on the journey of creating a circular navigation menu bar following the instructions provided in this link. Despite my efforts, I encountered a hurdle in the head section where ...

Toggle button visibility on ng-repeat item click

Hello everyone, I'm encountering an issue with displaying and hiding buttons in ng-repeat. <div class="row" ng-repeat="item in items"> <button type="button" ng-click="add()">+</button> <button type="button" ng-click="remo ...

100% width with a pixel offset

In the past, I have achieved this by using padding. The concept is to have two div elements positioned side by side, where one has a width of 100% and the other has a fixed width of 50px. Here's a rough illustration: ------------------------------- ...

Is there an issue with the JavaScript functionality of the max/min button?

Help needed with maximize/minimize button functionality as my JavaScript code is not working. Any suggestions for a solution would be greatly appreciated. Thank you in advance. Below is the code snippet: <html> <head> <script> $(functio ...

Alter the class names on a div element every 3 seconds using React

Looking to animate the movement of CSS classes sequentially? Imagine starting with an image and after 3 seconds, shifting all classes downward so the last one appears on top, creating a dynamic carousel effect. Any assistance would be greatly appreciated! ...

PHP Exception with dual inputs

I am currently exploring the best approach for capturing messages in my PHP code but I'm unsure if it's even possible. Within my simple PHP structure, I am using try and catch blocks like this: if (!$this->issetAndNotEmpty($id)) ...

Error message: "When using Webpack 4 with Bootstrap, a TypeError occurs where property 'jquery' is read as undefined."

I've recently delved into the world of webpack and everything seems to be running smoothly. However, when I run my webpack app, I encounter the following error within Bootstrap: var version = $.fn.jquery.split(' ')[0].split('.'); ...

How can I modify the ngx-datatable pager component to display text instead of icons and include a totalVisible property?

I am currently customizing the datatable-pager in ngx-dataTable and have been successful in adding footers and pagers. However, I am facing two issues that need resolution: How can I display text instead of icons for the prev/Next/First and Last buttons? ...