Foundation Equalizer
Foundation Equalizer(Equalizer)
We can add the data-equalizer
attribute to the container element and add the data-equalizer-watch
attribute to each child element to create an equalizer of equal height. The tallest element determines the height of the other elements.
Note: The slider requires JavaScript. So you need to initialize oundation JS:
Instance
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div class="row" data-equalizer> <h2>Foundation 均衡器(</h2> <p>相等高度容器:</p> <div class="medium-4 columns panel" data-equalizer-watch> <p>php中文网 -- php中文网!!</p> <p>php中文网 -- php中文网!!</p> <p><strong>我是最高的元素。其他元素使用我的搞定。</strong></p> </div> <div class="medium-4 columns panel" data-equalizer-watch> <p>php中文网 -- php中文网!!</p> <p>php中文网 -- php中文网!!</p> </div> <div class="medium-4 columns panel" data-equalizer-watch> <p>php中文网 -- php中文网!!</p> </div> </div> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
Run Instance»
Click the "Run Instance" button to view the online instance
Equalizers for different screens
Add data-equalizer-mq="value"
attributes to the equalizer to be different The screen size is set to the same height. The value can be one of the following:
Value | Description | Instance |
---|---|---|
##medium-up
| Default. Create a container with the same height and a width greater than 40.063em | |
Create Containers of the same height, width greater than 64.063em | Try it | |
Create containers of the same height, The width is greater than 90.063em | Try it||
Create a container with the same height and a width greater than 120.063em | Try it
is
data-equalizer
anddata- equalizer-watch attribute adds the same value. This will be connected together to the equalizer container.
Repeat the nested equalizers multiple times to make sure they match:
Instance
<!DOCTYPE html> <html> <head> <title>Foundation 实例</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://static.php.cn/assets/foundation-5.5.3/foundation.min.css"> <script src="http://static.php.cn/assets/jquery/2.0.3/jquery.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/foundation.min.js"></script> <script src="http://static.php.cn/assets/foundation-5.5.3/js/vendor/modernizr.js"></script> </head> <body> <div class="row" data-equalizer="first"> <h2>内嵌均衡器</h2> <p>一个均衡容器内嵌入另一个均衡容器:</p> <div class="medium-4 columns"> <div class="panel" data-equalizer-watch="first"> <h3>面板</h3> <div class="row" data-equalizer="second"> <div class="panel" data-equalizer-watch="second"> <h3>内嵌面板</h3> p>php中文网 -- php中文网!!</p> </div> <div class="panel" data-equalizer-watch="second"> <h3>内嵌面板</h3> <p>php中文网 -- php中文网!!</p> </div> <div class="panel" data-equalizer-watch="second"> <h3>内嵌面板</h3> <p>php中文网 -- php中文网!!</p> </div> </div> </div> </div> <div class="medium-4 columns"> <div class="panel" data-equalizer-watch="first"> <h3>面板</h3> <p>php中文网 -- php中文网!!</p> <p>php中文网 -- php中文网!!</p> </div> </div> <div class="medium-4 columns"> <div class="panel" data-equalizer-watch="first"> <h3>面板</h3> <p>php中文网 -- php中文网!!</p> </div> </div> </div> <!-- 初始化 Foundation JS --> <script> $(document).ready(function() { $(document).foundation(); }) </script> </body> </html>
Run Instance»
Click "Run instance" button to view online instances