ThemeForest

Posts by Yaeko

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

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.

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

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!

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

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!

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

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’ :D

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

Hello,

I’m a bit stuck with this simple piece of code: JSFiddle . Seems that it the trigger event doesn’t work on a ‘hover, mouseover’ or ‘mouseenter’ event?

Or does it only work with custom events except of ‘click, submit’?

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

Phpstorm

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

Found it:

$(items).each(function(){ itemWidth += $(this).width(); });
713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

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!

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

Prometheus :)

713 posts
  • Belgium
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
Yaeko says

nice job!

by
by
by
by
by