Theme Based Rendering
When we develop Framework7 app for multiple platforms with mutliple themes (ios
, md
, aurora
) we need to control which elements will appear for one or another theme, like showing different icon for iOS and MD themes.
There are special classes that allow to control this:
if-ios
- element will be rendered only for iOS themeif-not-ios
- element will be removed/hidden for theme other than iOSif-md
- element will be rendered only for MD themeif-not-md
- element will be removed/hidden for theme other than MDif-aurora
- element will be rendered only for Aurora themeif-not-aurora
- element will be removed/hidden for theme other than Aurora
This is, for example how we hide Navbar’s back button text for MD theme:
<div class="navbar">
<div class="navbar-inner sliding">
<div class="left">
<a href="#" class="link back">
<i class="icon icon-back"></i>
<!-- back button text will be visible only in iOS and Aurora themes -->
<span class="if-not-md">Back</span>
</a>
</div>
...
</div>
</div>
当前内容版权归 Framework7 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Framework7 .