javascript - How to display an action list on hover using bootstrap? - Stack Overflow

I have a html page likethis and when I hover the volume button which located on the right, the div bo

I have a html page like this and when I hover the volume button which located on the right, the div box which contains the Upload and Delete function should be displayed beside with the volume icon. What I expect is when I hover the volume icon, the Upload, Delete and volume icon should be displayed in the same line, like picture below
and grey panel will not be overflowed out of the box.

Does anyone have an idea how to set again the stylesheet to show this situation ?

I have a html page like this and when I hover the volume button which located on the right, the div box which contains the Upload and Delete function should be displayed beside with the volume icon. What I expect is when I hover the volume icon, the Upload, Delete and volume icon should be displayed in the same line, like picture below
and grey panel will not be overflowed out of the box.

Does anyone have an idea how to set again the stylesheet to show this situation ?

Share Improve this question edited Jan 27, 2016 at 11:20 SparK 5,2112 gold badges25 silver badges32 bronze badges asked Jan 27, 2016 at 11:09 user5567313user5567313 1
  • 1 Question title doesn't help... try "How to display an action list on hover using bootstrap?" – SparK Commented Jan 27, 2016 at 11:11
Add a ment  | 

3 Answers 3

Reset to default 5

make .prompt-audio-control display inline-block when they view on hover and not inline in order to fit next to each other:

.prompt-audio:hover .prompt-audio-control {
  display: inline-block;
}

Updated Fiddle: https://jsfiddle/y2ee6fsc/2/

Your elements that appear after hover had different value for display property. You can make them inline-block.

In order to make them on one line without changing html structure, you could remove overflow: hidden from .btn-file.

https://jsfiddle/wca36rqu/3/

i did some changes on your html and css maybe it will be help for you. https://jsfiddle/hamzanisar/j8p44she/

.btn-file {
    position: relative;
    overflow:hidden;
    margin:0 0 -2px 0;
}
.btn-file input[type=file] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    filter: alpha(opacity=0);
    opacity: 0;
    cursor:pointer;
    display: block;
}
.PlayPromptIcon, PlayPromptIcon:visited {
    color: grey;
}
.PlayPromptIcon:hover {
    text-shadow: 1px 1px 10px black;
}
.prompt-audio-control {
    display: none;
    padding: 0;
    margin: 0;
}
.prompt-audio:hover .prompt-audio-control, .prompt-audio:hover .nm li:nth-child(1), .prompt-audio:hover .nm li:nth-child(2) {
    display:inline-block;
}
.nm{
    margin:0px;
}
.nm li:nth-child(1), .nm li:nth-child(2){
    display:none;
}

HTML

 <div class="container-fluid">
        <div class="input-group prompt" col-xs-2> <span class="input-group-addon">Prompt</span>
            <input type="text" class="form-control tts-prompt" placeholder="Text to Speech Prompt!!" />
            <span class="input-group-addon prompt-audio">
            <ul class="list-unstyled list-inline nm">
                <li>
                    <a href="javascript:;" class="prompt-audio-control" >
                        <div class="btn-file">
                            <input type="file" accept="audio/wav|audio/pcm|audio|vox" />
                            <span> Upload </span> 
                        </div>
                    </a>
                </li>
                <li>
                    <a class="btn-link prompt-audio-control" type="file"> <span> Delete </span> </a>
                </li>
                <li> <a class="PlayPromptIcon" target="_blank"> <span class="glyphicon glyphicon-volume-up"></span></a> </li>
            </ul>
            </span> </div>
    </div>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745656778a4638587.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信