Sha256: df2cba04f8819e3354068dd1f48e586d1beaf1967e749d0e997e1641315b24ed
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
###* Content slots ============= It can be useful to mark "slots" in your page layout where you expect content to appear in the future. For example, you might have <div up-slot class="alerts"></div> <script> up.awaken('.alerts', function ($element) { RELOAD SHOULD NOT CACHE setInterval(3000, function() { up.reload('.alerts') }); }); </script> Seeing that the `.alerts` container is empty, Up.js will hide it: <div class="alerts" up-slot style="display: none"></div> As soon as you <div class="alerts" up-slot> Meeting at 11:30 AM </div> TODO: Write some documentation @class up.slot ### up.slot = (-> u = up.util hasContent = ($slot) -> u.trim($slot.html()) != '' check = ($element) -> u.findWithSelf($element, '[up-slot]').each -> $slot = $(this) unless hasContent($slot) $slot.hide() ###* Use this attribute to mark up empty element containers that you plan to update with content in the future. An element with this attribute is automatically hidden if it has no content, and is re-shown if it is updated with content. This is useful to prevent the element from applying unwanted margins to the surrounding page flow. @method [up-slot] @ujs ### up.bus.on 'fragment:ready', check )()
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
upjs-rails-0.6.2 | lib/assets/javascripts/up/slot.js.coffee |
upjs-rails-0.6.1 | lib/assets/javascripts/up/slot.js.coffee |
upjs-rails-0.6.0 | lib/assets/javascripts/up/slot.js.coffee |