消息框Message

可任意添加文本元素,自定义图标,消息框内添加data-close-message属性的元素会触发关闭

消息框 Message - 图1

  1. <div class="message">
  2. <i data-close-message></i>
  3. <p><i class="flaticon-information59 mr3"></i>We just need a little more info to create your account. <a href="#">link text</a></p>
  4. </div>
Benefits of registration include:

消息框 Message - 图2

  1. <div class="message">
  2. <i data-close-message></i>
  3. <h5>Benefits of registration include:</h5>
  4. <ol class="baselist">
  5. <li>Exclusive offers & sneak peeks</li>
  6. <li>Instant order tracking</li>
  7. <li>Award-winning customer service</li>
  8. </ol>
  9. <button type="button" class="btn xs" data-close-message>Close</button>
  10. </div>

场景Scenes

添加class="info"、class="correct"、class="warning"、class="error"转换为不同场景

消息框 Message - 图3

  1. <div class="message info">
  2. <i data-close-message></i>
  3. <p><i class="flaticon-information59 mr3"></i>We just need a little more info to create your account. <a href="#">link text</a></p>
  4. </div>
  5. <div class="message correct">
  6. <i data-close-message></i>
  7. <p><i class="flaticon-verification16 mr3"></i>Your account has been created successfully. <a href="#">link text</a></p>
  8. </div>
  9. <div class="message warning">
  10. <i data-close-message></i>
  11. <p><i class="flaticon-exclamation26 mr3"></i>Your username or password is incorrect. <a href="#">link text</a></p>
  12. </div>
  13. <div class="message error">
  14. <i data-close-message></i>
  15. <p><i class="flaticon-prohibition18 mr3"></i>The passwords you entered do not match. <a href="#">link text</a></p>
  16. </div>

弹出Pop up

为触发元素添加data-open-message属性,并用其来绑定消息框内容,添加name属性的消息框会自动隐藏,添加class="mask"属性使消息框弹出位置是悬浮的

消息框 Message - 图4

  1. Click Button:
  2. <button type="button" class="btn" data-open-message="element1">Default</button>
  3. <button type="button" class="btn" data-open-message="element2">Mask</button>
  4. Default:
  5. <div name="element1" class="message">
  6. <i data-close-message></i>
  7. <h5>Benefits of registration include:</h5>
  8. <ol class="baselist">
  9. <li>Exclusive offers & sneak peeks</li>
  10. <li>Instant order tracking</li>
  11. <li>Award-winning customer service</li>
  12. </ol>
  13. </div>
  14. Mask:
  15. <div name="element2" class="message mask">
  16. ...
  17. </div>

相同name属性值的消息框将会绑定为同一个序列组

消息框 Message - 图5

  1. Click Button:
  2. <button type="button" class="btn" data-open-message="array1">Array</button>
  3. Message:
  4. <div name="array1" class="message info mask">
  5. <i data-close-message></i>
  6. <h5>Benefits of registration include:</h5>
  7. <ol class="baselist">
  8. <li>Exclusive offers & sneak peeks</li>
  9. <li>Instant order tracking</li>
  10. <li>Award-winning customer service</li>
  11. </ol>
  12. </div>
  13. <div name="array1" class="message correct mask">
  14. ...
  15. </div>
  16. <div name="array1" class="message warning mask">
  17. ...
  18. </div>
  19. <div name="array1" class="message error mask">
  20. ...
  21. </div>

超时关闭Close Timeout

添加data-close-timeout属性设定消息框的超时关闭时间,单位是ms毫秒,可设定的最小值为500

消息框 Message - 图6

  1. Click Button:
  2. <button type="button" class="btn" data-open-message="array2">Array</button>
  3. Message:
  4. <div name="array2" class="message info mask" data-close-timeout="2000">
  5. <i data-close-message></i>
  6. <h5>Benefits of registration include:</h5>
  7. <ol class="baselist">
  8. <li>Exclusive offers & sneak peeks</li>
  9. <li>Instant order tracking</li>
  10. <li>Award-winning customer service</li>
  11. </ol>
  12. </div>
  13. <div name="array2" class="message correct mask" data-close-timeout="2500">
  14. ...
  15. </div>
  16. <div name="array2" class="message warning mask" data-close-timeout="3000">
  17. ...
  18. </div>
  19. <div name="array2" class="message error mask" data-close-timeout="3500">
  20. ...
  21. </div>

自定义风格Custom Style

可以使用自定义风格工具快速创建CSS

消息框 Message - 图7

  1. <div class="message mystyle">
  2. ...
  3. </div>
  4. <div class="message info mystyle">
  5. ...
  6. </div>
  7. <div class="message correct mystyle">
  8. ...
  9. </div>
  10. <div class="message warning mystyle">
  11. ...
  12. </div>
  13. <div class="message error mystyle">
  14. ...
  15. </div>