欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

AmazeUI 下拉组件 博客分类: 阅-AmUI  

程序员文章站 2024-03-25 15:53:34
...
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>下拉组件</title>
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<link rel="icon" type="image/png" href="assets/i/favicon.png">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" sizes="192x192" href="assets/i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Amaze UI"/>
<link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
<meta name="msapplication-TileImage" content="assets/i/app-icon72x72@2x.png">
<meta name="msapplication-TileColor" content="#0e90d2">
<link rel="stylesheet" href="assets/css/amazeui.min.css">
<!--[if (gte IE 9)|!(IE)]><!-->
<script src="assets/js/jquery.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="assets/ie8/jquery.min.js"></script>
<script src="assets/ie8/modernizr.js"></script>
<script src="assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<script src="assets/js/amazeui.min.js"></script>
</head>
<body style="margin: 100px;">
<!--下拉列表-->
<div class="am-dropdown" data-am-dropdown>
  <button class="am-btn am-btn-primary am-dropdown-toggle" data-am-dropdown-toggle>下拉列表 <span class="am-icon-caret-down"></span></button>
  <ul class="am-dropdown-content">
    <li class="am-dropdown-header">标题</li>
    <li><a href="#">快乐的方式不只一种</a></li>
    <li class="am-active"><a href="#">最荣幸是</a></li>
    <li><a href="#">谁都是造物者的光荣</a></li>
    <li class="am-disabled"><a href="#">就站在光明的角落</a></li>
    <li class="am-divider"></li>
    <li><a href="#">天空海阔 要做最坚强的泡沫</a></li>
  </ul>
</div>
<!--上拉列表-->
<div class="am-dropdown am-dropdown-up" data-am-dropdown>
  <button class="am-btn am-btn-danger am-dropdown-toggle" data-am-dropdown-toggle>上拉列表 <span class="am-icon-caret-up"></span></button>
  <ul class="am-dropdown-content">
    <li class="am-dropdown-header">标题</li>
    <li><a href="#">快乐的方式不只一种</a></li>
    <li class="am-active"><a href="#">最荣幸是</a></li>
    <li><a href="#">谁都是造物者的光荣</a></li>
    <li class="am-disabled"><a href="#">就站在光明的角落</a></li>
    <li class="am-divider"></li>
    <li><a href="#">天空海阔 要做最坚强的泡沫</a></li>
  </ul>
</div>
<!--下拉内容-->
<div class="am-dropdown" data-am-dropdown>
  <button class="am-btn am-btn-success am-dropdown-toggle">Dropdown <span class="am-icon-caret-down"></span></button>
  <div class="am-dropdown-content">
    <h2>I am what I am</h2>
    <p>
      多么高兴 在琉璃屋中快乐生活
      对世界说 甚么是光明和磊落
      我就是我 是颜色不一样的烟火
    </p>
  </div>
</div>
<!--下拉宽度适应-->
<div id="doc-dropdown-justify">
  <div class="am-dropdown" data-am-dropdown="{justify: '#doc-dropdown-justify'}">
    <button class="am-btn am-btn-success am-dropdown-toggle">宽度适应下拉 <span class="am-icon-caret-down"></span></button>
    <div class="am-dropdown-content">
      <h2>I am what I am</h2>
      <p>
        多么高兴 在琉璃屋中快乐生活
        对世界说 甚么是光明和磊落
        我就是我 是颜色不一样的烟火
      </p>
    </div>
  </div>
</div>
<!--通过 JS-->
<div id="doc-dropdown-justify-js" style="width: 400px">
  <div class="am-dropdown" id="doc-dropdown-js">
    <button class="am-btn am-btn-danger am-dropdown-toggle">通过 JS 调用 <span class="am-icon-caret-down"></span></button>
    <div class="am-dropdown-content">...</div>
  </div>
</div>
<script>
  $(function() {
    $('#doc-dropdown-js').dropdown({justify: '#doc-dropdown-justify-js'});
  });
</script>
<div style="height: 100px;"></div>
<button class="am-btn am-btn-secondary" id="doc-dropdown-toggle">调用 Toggle</button>
<button class="am-btn am-btn-success" id="doc-dropdown-open">调用 Open</button>
<button class="am-btn am-btn-warning" id="doc-dropdown-close">调用 Close</button>
<script>
  $(function() {
    var $dropdown = $('#doc-dropdown-js'),
        data = $dropdown.data('amui.dropdown');
    $('#doc-dropdown-toggle').on('click', function(e) {
      $dropdown.dropdown('toggle');
      return false;
    });
    $('#doc-dropdown-open').on('click', function(e) {
      data.active ? alert('已经打开了,施主又何必再纠缠呢!') : $dropdown.dropdown('open');
      return false;
    });
    $('#doc-dropdown-close').on('click', function(e) {
      data.active ? $dropdown.dropdown('close') : alert('没有开哪有关,没有失哪有得!');
      return false;
    });
    $dropdown.on('open.dropdown.amui', function (e) {
      console.log('open event triggered');
    });
  });
</script>
</body>
</html>	

 

效果图:
AmazeUI 下拉组件
            
    
    博客分类: 阅-AmUI  
 

  • AmazeUI 下拉组件
            
    
    博客分类: 阅-AmUI  
  • 大小: 6.6 KB