Home › Forums › JavaScript › Equal Height Blocks in Rows
- This topic is empty.
-
AuthorPosts
-
January 8, 2012 at 11:32 pm #36027
Pithdog
ParticipantI’ve been using the code from the example for the tutorial “Equal Height Blocks in Rows”. It works fantastic, except for one thing.
When I resize the browser, the heights of the boxes aren’t recalculating and resizing the boxes, they’re just retaining their original value.
I even tested that the resize event was working and firing, by removing all other event triggers (onLoad, document ready, etc) and just using the resize. When the page loaded, all the items were not the same height, but the first resize event that triggered fixed them all up, but then didn’t proceed to continually fix them like I hope.
Is this not part of the script? I’d like it so that when the user resizes the browser, it calculates it either after they’ve stopped resizing, or during.
Thanks :D
January 8, 2012 at 11:56 pm #94305DanaB
MemberWell, Chris’ demo is working for me in the latest version of Firefox. Therefore you need to give us some more information. Set up a jsfiddle with your code and let us know what browser you are using.
January 9, 2012 at 9:26 am #94334Mottie
MemberHi Pithdog!
I actually turned that code into a plugin called Equalizer. I’m pretty sure (it’s been a while since I looked at it) that I fixed the resize problems.
January 10, 2012 at 7:04 pm #94398Pithdog
ParticipantMottie you legend! Works exactly as I need it to in your example, I’ll try it out tonight and see if it works in my production :D
DanaB: In future I’ll provide a jsfiddle :)
January 12, 2012 at 6:56 am #94458Pithdog
ParticipantIs there an easy way to adapt it so that if an element already has an equalizer-inner within it, to not add another one?
Also is it easy to make this script work with and onclick event? Like, onclick resize columns?
January 12, 2012 at 9:22 am #94470Mottie
MemberHi Pithdog,
What do you mean by adding another one? Are you calling the plugin more than once? If you need to re-adjust the columns using an onclick then call the update function like this:
$('body').data('Equalizer').equalz();
January 13, 2012 at 6:32 am #94519Pithdog
ParticipantI was trying to call it multiple times. I have a button which changes the class on the container of the columns; so they all get different heights and widths etc. So I needed to recall the function when the button was clicked, but the update function would work better. I’ll try it out soon!
January 13, 2012 at 7:42 am #94520Mottie
MemberActually, I just made a lot of changes to the plugin last night. So now to update, you can just call the plugin again (new options will be ignored) or use the update method (renamed from “equalz” to “update”) and saved the data to the wrapper element instead of the body:
// old format was $('.wrapper > div').equalizer();
// new format moves the columns into an option
$('.wrapper').equalizer({ columns: "> div" });To update use:
$('.wrapper').equalizer();
Or use
$('.wrapper').data('equalizer').update();
* Please note the new format and that “equalizer” is no longer capitalized.
January 14, 2012 at 9:12 am #94592Pithdog
ParticipantYou’re amazing! It’s as if my every wish is coming true in this plugin :) thanks for your continuing work, everyone creating responsive websites with columns needs to know about this :)
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.