Table of Contents
回复讨论(解决方案)
Home Web Front-end HTML Tutorial Is there any non-select drop-down selection? _html/css_WEB-ITnose

Is there any non-select drop-down selection? _html/css_WEB-ITnose

Jun 24, 2016 am 11:39 AM

有没有非select 的下拉选择? 就等于是一个下拉式的滑动门。找了好多,无一例外都是select 的模拟器的等。
不需要模拟的那么麻烦,就是一个下拉,然后被选择的项目出现在第一,后面切换一个滑动。
哎,这玩意真不好描述。


回复讨论(解决方案)

实在不好描述,上个图吧。

有人有么?非常感谢啊!

这个一般都是js配合css完成的,你搜一下下拉菜单插件

怎么说呢。。。。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>statistics test</title> <script src="http://www.w3school.com.cn/jquery/jquery-1.11.1.min.js"></script> <style type="text/css"> .dropdiv{ width: 180px; height: 24px; overflow: hidden; float: left; font-size: 13px; font-family: "微软雅黑"; position: relative; padding: 0px 26px 0px 5px; border: solid 1px #cecece; background: url(../images/droparrow.png) 186px no-repeat; } .dropmiandiv{ margin-left: 40px; width: 213px; background: url(../images/dropdown.png) repeat-x; height: 27px; } .chooseItems{ border: solid 1px #cecece; } .chooseItems .chooseItem{ font-size: 13px; font-family: "微软雅黑"; padding: 5px; border-bottom: solid 1px #cecece; } .chooseItems .chooseItem:last-child{ border-bottom:none; } .chooseItems .chooseItem:hover{ background: #f2f2f2; } </style> </head> <body> <div class="dropmiandiv" quest ="select1"> <input type="text" readonly="readonly" id ="select1" displayMember="-1" valueMember ="请选择" class="dropdiv" value="请选择"/> </div> <div class="chooseItems" answer ="select1" style="display:none; position:absolute;"> <div class="chooseItem" displayMember="0" valueMember ="独立注册译员">独立注册译员</div> <div class="chooseItem" displayMember="1" valueMember ="供应商译员">供应商译员</div> <div class="chooseItem" displayMember="2" valueMember ="供应商">供应商</div> <div class="chooseItem" displayMember="3" valueMember ="代理商">代理商</div> </div> <div class="dropmiandiv" quest ="select2" style="position:absolute;top:200px;"> <input type="text" readonly="readonly" id ="select2" displayMember="-1" valueMember ="请选择" class="dropdiv" value="请选择"/> </div> <div class="chooseItems" answer ="select2" style="display:none; position:absolute;"> <div class="chooseItem" displayMember="0" valueMember ="独立注册译员">独立注册译员</div> <div class="chooseItem" displayMember="1" valueMember ="供应商译员">供应商译员</div> <div class="chooseItem" displayMember="2" valueMember ="供应商">供应商</div> <div class="chooseItem" displayMember="3" valueMember ="代理商">代理商</div> </div> </body> </html> <script type="text/javascript"> $(".dropdiv").click(function(e){ $(".chooseItems").slideUp(300); e.stopPropagation(); var quest = $(this).parent(); var questwidth = parseInt(quest.width())-2; var questheight = quest.height(); var left = quest.position().left+parseInt(quest.css("margin-left"))+parseInt(quest.css("padding-left")); var top = parseInt(quest.position().top)+parseInt(questheight)+4; var attrs = quest.attr("quest"); var selectsd = $('.chooseItems[answer='+attrs+']'); var selectsdHeight = selectsd.height(); if((top+selectsdHeight)>$(window).height()){ top = top - selectsdHeight - questheight-7; } if($(selectsd).is(":visible")){ $(selectsd).slideUp(300); }else{ $(selectsd).css({"left":left+"px","top":top+"px","width":questwidth+"px"}).slideDown(300); } }); $(".chooseItem").click(function(e){ e.stopPropagation(); var divhtml = $(this); var displayMember,valueMember; displayMember = divhtml.attr("displayMember"); valueMember = divhtml.attr("valueMember"); var attrs =$(this).parent().attr("answer"); var parent = $("#"+attrs); var olddisplayMember,oldvalueMember; olddisplayMember = parent.attr("displayMember"); oldvalueMember = parent.attr("valueMember"); if(olddisplayMember !=displayMember){ parent.attr("displayMember",displayMember); parent.attr("valueMember",valueMember); parent.val(valueMember); parent.change(); } $(this).parent().slideUp(300); }); $(document).click(function(e){ var target = $(e.target); if(target.closest(".chooseItems").length == 0){ $(".chooseItems").slideUp(300); } }); </script> 
Copy after login

    


            
            

              
111111111

              
222222222222

              
              
            

          


                                           ;script src="http://bootstrap.ninghao.net/assets/js/bootstrap-tab.js">
This is the effect, but this code is too much. Simple JQ implementation, does any master have a favorite?

  • Movies

  • ="#dropdown2" data-toggle="tab">American drama

    The effect of these two items

    The above effect is that there is too much JS Now, it would be nice if the three JS can be separated. The effect is the one I posted. Pull down to switch the TAB box behind

    and you can achieve it with this. There is a demonstration in it. The best suggestion is to directly change the demonstration code, which is the fastest.

    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

    Hot AI Tools

    Undresser.AI Undress

    Undresser.AI Undress

    AI-powered app for creating realistic nude photos

    AI Clothes Remover

    AI Clothes Remover

    Online AI tool for removing clothes from photos.

    Undress AI Tool

    Undress AI Tool

    Undress images for free

    Clothoff.io

    Clothoff.io

    AI clothes remover

    AI Hentai Generator

    AI Hentai Generator

    Generate AI Hentai for free.

    Hot Article

    Repo: How To Revive Teammates
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌
    R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
    2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
    Hello Kitty Island Adventure: How To Get Giant Seeds
    1 months ago By 尊渡假赌尊渡假赌尊渡假赌

    Hot Tools

    Notepad++7.3.1

    Notepad++7.3.1

    Easy-to-use and free code editor

    SublimeText3 Chinese version

    SublimeText3 Chinese version

    Chinese version, very easy to use

    Zend Studio 13.0.1

    Zend Studio 13.0.1

    Powerful PHP integrated development environment

    Dreamweaver CS6

    Dreamweaver CS6

    Visual web development tools

    SublimeText3 Mac version

    SublimeText3 Mac version

    God-level code editing software (SublimeText3)

    Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update? Difficulty in updating caching of official account web pages: How to avoid the old cache affecting the user experience after version update? Mar 04, 2025 pm 12:32 PM

    The official account web page update cache, this thing is simple and simple, and it is complicated enough to drink a pot of it. You worked hard to update the official account article, but the user still opened the old version. Who can bear the taste? In this article, let’s take a look at the twists and turns behind this and how to solve this problem gracefully. After reading it, you can easily deal with various caching problems, allowing your users to always experience the freshest content. Let’s talk about the basics first. To put it bluntly, in order to improve access speed, the browser or server stores some static resources (such as pictures, CSS, JS) or page content. Next time you access it, you can directly retrieve it from the cache without having to download it again, and it is naturally fast. But this thing is also a double-edged sword. The new version is online,

    How to efficiently add stroke effects to PNG images on web pages? How to efficiently add stroke effects to PNG images on web pages? Mar 04, 2025 pm 02:39 PM

    This article demonstrates efficient PNG border addition to webpages using CSS. It argues that CSS offers superior performance compared to JavaScript or libraries, detailing how to adjust border width, style, and color for subtle or prominent effect

    How do I use HTML5 form validation attributes to validate user input? How do I use HTML5 form validation attributes to validate user input? Mar 17, 2025 pm 12:27 PM

    The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

    What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

    The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

    What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

    The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

    What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

    The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

    What are the best practices for cross-browser compatibility in HTML5? What are the best practices for cross-browser compatibility in HTML5? Mar 17, 2025 pm 12:20 PM

    Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

    What is the purpose of the <iframe> tag? What are the security considerations when using it? What is the purpose of the <iframe> tag? What are the security considerations when using it? Mar 20, 2025 pm 06:05 PM

    The article discusses the &lt;iframe&gt; tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

    See all articles