You’re absolutely correct.
But when you apply some CSS to any element via .css() and you execute another whatever function and there you add a log of that one element, in Chrome the CSS isn’t always correct, sometimes it’s applied before the log, sometimes after … this is because Chrome executes it to quickly.
That’s why I would like to work with a callback, changing $(document).ready() to $(window).load() works, but then you’re elements are ‘glitching’ if you know what I mean.
Just tested it with a custom event, for the moment it seems to be working.
aleluja said
You can’t create an onStyleChange event in jQuery unless you edit the jquery.js file itself, and it would be a bad practice (caching, updates and so on). You can write a plugin that overrides the .css function and does your callback.Check out this – the answer is in the question.
But still, I would stick to calling the callback where I call the css change in code.
This looks great, I’ll try out. Thanks!
Hi guys,
I’ve been Googling for some time now to find a way to use a callback when CSS is being applied with jQuery to an element.
I need this because I’m putting dynamically CSS to an element and if that applied CSS property is applied another function has to be triggered.
I thought using a setTimeout, which works, but I find the too unstable.
Anyone has another idea?
Thanks!
Thanks guys!
I thought so, but was hoping if someone else knew a ‘hack’ where it was possible to perform it with an actual ‘hover’ 
Phpstorm
Found it:
$(items).each(function(){
itemWidth += $(this).width();
});
Hi,
Here’s a simple question for you Javascript guru’s
.
Here’s the thing, I have a ul list in which every li tag has an image. (don’t know how many li items with images there can be, it’s dynamic).
Now I want to know the width of the image (which should all be the same but you never know).
So I have my code here:
$(items).each(function(){
itemWidth = $(this).width();
totalWidth += itemWidth;
});
console.log("totalWidth: ", totalWidth);
items is the var where I get the images. So I don’t think that this code will work and it doesn’t
.
If anyone can help me out here?
Thanks!
Prometheus 
nice job!
