Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is needed to calculate the page sizes correct by javascript and apply scroll events or somthing like this.
I tested it to replace the folowing:
$(window).bind('resize.omegamediaqueries', function () {
setCurrentLayout(dummy.css('z-index'));
}).load(function () {
$(this).trigger('resize.omegamediaqueries');
});
by
$(window).bind('resize.omegamediaqueries', function () {
setCurrentLayout(dummy.css('z-index'));
$(this).trigger('resize.omegamediaqueries.done');
}).load(function () {
$(this).trigger('resize.omegamediaqueries');
});
For me this works fine and I got no longer race conditions between load event and the manipulation of the media query classes.
Thank you.
BR Thomas
Comments
Comment #1
Cellar Door CreditAttribution: Cellar Door commentedWhat do you think himerus? 3.2 or is this a one-off use case?
Comment #2
protractor CreditAttribution: protractor commentedThis is essential if you like to build things that need beware of the sizes of elements after scaling by javascript fallback. Scroll the page is one thing, other things could be to reinitialize a geocoder field with the new sizes and so on. There are a lot of modules that do not change the classes of their elements and set instead inline styles so you have to reinitialize the things by javascript on this event to get the page not broken with omega. If you have a lot of javascript and dynamic on the page you will need this event more often. With my hacked module all that cases run smooth.
Just think about more usecases there are a lot.
3.2 would be nice. Thanks in advanced.
Comment #3
dwatts3624 CreditAttribution: dwatts3624 commentedI would second the need for a more developed solution to this problem.
It might just be my lacking JavaScript skills, but it's been difficult to find a solution that will give me a way to isolate all my JS functions that have to do with the layouts (sizes, etc.) to only run when the page is loaded or the layout changes.
I've been following the thread below and have had luck with the solutions later in the thread but I'm still running into inconsistencies. Mainly that my layout stalls for some time if I'm running a few calculations when binding to "responsivelayout". But it works fine when binding to load & resize -- which must be far more resource intensive than the later.
http://drupal.org/node/1478648
Just to give you a use case: I have a number of sliders on my page to fold up content (using views slideshow). I've disabled its control over the height and width of the slides and container since it wasn't giving desirable results and am calculating them myself by targeting their parent region's height...and some other things for the width. Rather than hard coding these values into CSS it seems cleaner to me to write a line or two of JS to just calculate this. This solution works fine by binding the calculations to window load & resize. But, like I said, I worry that binding to resize is not an efficient solution. Ideally this would only occur when the layout changed.
Any help from the Omega team would be greatly appreciated!
DW
Comment #4
apaderno