[英]How to open menu with dropdown effect?
I have a script menu on Filter by button.Now, when I press button, the menu is opened horizontal.But I want to open it with an effect like drop down menu.我在按按钮过滤上有一个脚本菜单。现在,当我按下按钮时,菜单是水平打开的。但我想用下拉菜单等效果打开它。 How can I be able to give a dropdown effect for this?
我怎样才能为此提供下拉效果? I want w down effect at click, not hover.
我想要点击时的向下效果,而不是悬停。 Because I have 3 fields and, at click on
Filter by
I want to have a dropdown menu.Can I add something like this in JavaScript?因为我有 3 个字段,并且点击
Filter by
我想要一个下拉菜单。我可以在 JavaScript 中添加这样的东西吗?
$(".search-button").click(function(){ $(".search-event").toggle(1000); });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <a href="#" style="font-size: 14px; float: right; color: #555" class="search-button" type="button" style="float: right; margin-left: 10px">Filter by <i class="fa fa-angle-down"></i></a>
<div class="search-event" style="display:none">
{!! Form::open(['class' => 'sky-form','url' => 'view-all-event','id' => 'sky-form4','method' => 'GET','style' => 'border:none']) !!}
<div class="input-group">
<div class="row">
<div class="col col-3">
<label class="select">
<select name="category">
<option value="">Topic</option>
@foreach($parent_category as $parent)
<optgroup label="{{ $parent->category }}">
@foreach($child_category as $child)
@if($parent->id == $child->parent_id)
<option value="{{ $child->category_url }}" <?php if($category == $child->category_url ){ echo "selected"; } ?>>{{ $child->category }}</option>
@endif
@endforeach
</optgroup>
@endforeach
</select>
<i></i>
</label>
</div>
<div class="col col-3">
<label class="select">
<select name="event_type">
<option value="">Event type</option>
@foreach($evnetTypeList as $evnettype)
<option value="{{ $evnettype->id }}_{{ Slugify::slugify($evnettype->event_type) }}" <?php if($event_type == $evnettype->id.'_'.Slugify::slugify($evnettype->event_type)){ echo "selected"; } ?>>{{ $evnettype->event_type }}</option>
@endforeach
</select>
<i></i>
</label>
</div>
<div class="col col-3">
<label class="select">
{!! Form::select('country',$countryList,$country) !!}
<i></i>
</label>
</div>
<div class="col col-3">
<label class="input">
<i class="icon-append fa fa-calendar"></i>
<input type="text" name="starting_date" id="date" value="{{ $starting_date }}">
</label>
</div>
</div>
<span class="input-group-btn" style="vertical-align:top">
<button class="btn-u" type="submit"><i class="fa fa-search"></i></button>
<!-- {!! Form::submit('Save Changes' ,['class' => 'btn-u']) !!} -->
</span>
</div>
You can use transition in combination with opacity to create this effect in css.您可以将 transition 与 opacity 结合使用以在 css 中创建此效果。
.stuffToAnimate{
...
opacity: 0;
transition: all .5s ease;
...
}
and when the toggle event is raised you can set the opacity to 1 and your menu will ease to full visibility.当触发切换事件时,您可以将不透明度设置为 1,您的菜单将变得完全可见。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.