LoginSignup
0
0

More than 5 years have passed since last update.

baserJSで要素の高さを揃える

Posted at

コーポレートサイトにちょうどいいJavaScriptライブラリ baserJS の解説記事です。

Webサイトと詳しいAPIリファレンスはこちら baserJS Webサイト

floatさせたブロックなどの高さを揃える

サンプル

JavaScript

// 全ての対象のボックスの高さを揃える
$('.box').bcBoxAlignHeight();

// 対象のボックスを3個ずつ高さを揃える
// ※3カラムのときなど
$('.box').bcBoxAlignHeight(3);

// 複数のグループをまたがるとき
$('.group').bcBoxAlignHeight(3, '.box');

// 各要素の高さを揃える直前で呼び出すコールバック
$('.group').bcBoxAlignHeight(3, null, function (maxHeight, currentHeight, $targets) {
    // falsyな値を返すと高さの調整をキャンセルできる
    retrun false;
});
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0