Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
iPhone
Watch
iPad
Mac
iPhone
Watch
iPad
Mac
css
.select-menu { --background: #fff; --text: #171C28; --icon: #3F4656; --shadow: rgba(18, 22, 33, .2); position: relative; } .select-menu select, .select-menu button { font-family: "Mukta Malar", Arial; font-weight: 500; font-size: 14px; line-height: 21px; margin: 0; border: 0; outline: 0; text-align: left; text-transform: none; -webkit-appearance: none; } .select-menu select { pointer-events: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; opacity: 0; padding: 8px 36px 8px 10px; visibility: hidden; } .select-menu button { position: absolute; left: 0; top: 0; right: 0; bottom: 0; padding: 0; width: 100%; display: block; cursor: pointer; overflow: hidden; border-radius: 6px; box-shadow: 0 4px 12px var(--shadow); color: var(--text); background: var(--background); } .select-menu button div { position: relative; } .select-menu button div span { display: block; padding: 8px 32px 8px 10px; } .select-menu button div span.next { position: absolute; width: 100%; } .select-menu button em { --r: 45deg; display: block; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -4px; } .select-menu button em:before { content: ""; width: 7px; height: 7px; display: block; transform: rotate(var(--r)) scale(0.75); border-right: 2px solid var(--icon); border-bottom: 2px solid var(--icon); } .select-menu.vertical button div { display: flex; } .select-menu.vertical button div span { left: 0; bottom: 100%; } .select-menu.horizontal button div { display: flex; } .select-menu.horizontal button div span { right: 100%; top: 0; } .select-menu.horizontal button em { --r: -45deg; margin-top: -3px; } .select-menu.change button { -webkit-animation: bounce-vertical 0.45s linear; animation: bounce-vertical 0.45s linear; } .select-menu.change button div { -webkit-animation: button-vertical 0.6s linear forwards 0.05s; animation: button-vertical 0.6s linear forwards 0.05s; } .select-menu.change button em { -webkit-animation: arrow-vertical 0.45s linear; animation: arrow-vertical 0.45s linear; } .select-menu.change.horizontal button { -webkit-animation-name: bounce-horizontal; animation-name: bounce-horizontal; } .select-menu.change.horizontal button div { -webkit-animation-name: button-horizontal; animation-name: button-horizontal; } .select-menu.change.horizontal button em { -webkit-animation-name: arrow-horizontal; animation-name: arrow-horizontal; } @-webkit-keyframes bounce-vertical { 20% { transform: translateY(0); } 50% { transform: translateY(2px); box-shadow: 0 2px 8px var(--shadow); } } @keyframes bounce-vertical { 20% { transform: translateY(0); } 50% { transform: translateY(2px); box-shadow: 0 2px 8px var(--shadow); } } @-webkit-keyframes bounce-horizontal { 20% { transform: translateX(0); } 50% { transform: translateX(2px); box-shadow: 0 8px 12px var(--shadow); } } @keyframes bounce-horizontal { 20% { transform: translateX(0); } 50% { transform: translateX(2px); box-shadow: 0 8px 12px var(--shadow); } } @-webkit-keyframes button-vertical { 40% { transform: translateY(108%); } 75% { transform: translateY(99%); } 100% { transform: translateY(100%); } } @keyframes button-vertical { 40% { transform: translateY(108%); } 75% { transform: translateY(99%); } 100% { transform: translateY(100%); } } @-webkit-keyframes button-horizontal { 40% { transform: translateX(104%); } 75% { transform: translateX(99%); } 100% { transform: translateX(100%); } } @keyframes button-horizontal { 40% { transform: translateX(104%); } 75% { transform: translateX(99%); } 100% { transform: translateX(100%); } } @-webkit-keyframes arrow-vertical { 20% { transform: translateY(var(--h)); filter: blur(0.5px); opacity: 1; } 21% { transform: translateY(var(--h)); opacity: 0; } 22% { transform: translateY(calc(var(--h) * -1)); opacity: 0; } 23% { transform: translateY(calc(var(--h) * -1)); opacity: 1; } 50% { transform: translateY(4px); filter: blur(0); } 100% { transform: translateY(0); } } @keyframes arrow-vertical { 20% { transform: translateY(var(--h)); filter: blur(0.5px); opacity: 1; } 21% { transform: translateY(var(--h)); opacity: 0; } 22% { transform: translateY(calc(var(--h) * -1)); opacity: 0; } 23% { transform: translateY(calc(var(--h) * -1)); opacity: 1; } 50% { transform: translateY(4px); filter: blur(0); } 100% { transform: translateY(0); } } @-webkit-keyframes arrow-horizontal { 20% { transform: translateX(var(--w)); filter: blur(0.5px); opacity: 1; } 21% { transform: translateX(var(--w)); opacity: 0; } 22% { transform: translateX(calc(var(--w) * -1)); opacity: 0; } 23% { transform: translateX(calc(var(--w) * -1)); opacity: 1; } 50% { transform: translateX(4px); filter: blur(0); } 100% { transform: translateX(0); } } @keyframes arrow-horizontal { 20% { transform: translateX(var(--w)); filter: blur(0.5px); opacity: 1; } 21% { transform: translateX(var(--w)); opacity: 0; } 22% { transform: translateX(calc(var(--w) * -1)); opacity: 0; } 23% { transform: translateX(calc(var(--w) * -1)); opacity: 1; } 50% { transform: translateX(4px); filter: blur(0); } 100% { transform: translateX(0); } } html { box-sizing: border-box; -webkit-font-smoothing: antialiased; } * { box-sizing: inherit; } *:before, *:after { box-sizing: inherit; } body { min-height: 100vh; display: flex; justify-content: center; align-items: center; background: #275EFE; font-family: "Mukta Malar", Arial; } @media (max-width: 400px) { body { flex-direction: column; } } body .select-menu { margin: 20px; }
JavaScript
$('select[data-menu]').each(function() { let select = $(this), type = select.data('menu'), menu = $('
').addClass('select-menu ' + type), button = $('
'), buttonDiv = $('
'), current = $('
').text(select.find('option:selected').text()).appendTo(buttonDiv), arrow = $('
').prependTo(button); button.css({ '--h': select.outerHeight(), '--w': select.outerWidth() }); select.wrap(menu); button.append(buttonDiv).insertAfter(select); }); $(document).on('click', '.select-menu', function(e) { let menu = $(this), select = menu.children('select'), options = select.find('option'), active = select.find('option:selected'), button = menu.children('button'), buttonDiv = button.children('div'), current = buttonDiv.children('span'); if(!menu.hasClass('change')) { let nextOption = options.eq(active.index() == options.length - 1 ? 0 : active.index() + 1), next = $('
').addClass('next').text(nextOption.text()).appendTo(buttonDiv); options.attr('selected', false); nextOption.attr('selected', true); menu.addClass('change'); setTimeout(() => { next.removeClass('next'); menu.removeClass('change'); current.remove(); }, 650); } });
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>单选择菜单-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号