Thursday, February 9, 2017

jQuery - never call offset() method on hidden element

In jQuery, a call to .offset() method of a hidden element might lead to wrong coordinates being obtained.

For example, this code is going to produce wrong results:

jQuery(".hover-gallery").offset( jelem.offset() );

The correct way to do it:

jQuery(".kd-hover-gallery").offset( jelem.offset() );

More info here:

No comments:

Post a Comment

Ubuntu 12.04, 14.04, 16.04 - auto start an app or script before login

To run a command or application at startup, even before the user has logged in, you can use this file: /etc/rc.local The commands entered...