使用 Laravel 隐藏和显示特定 div 而不使用 jquery 的最佳方法是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40428684/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the best way using Laravel to hide and show a particular div without using jquery to do this?
提问by Crystal
I have a div that I would like to show when the button "See more Details" is clicked, I then would like to hide this when the button "See Less Details" is clicked.
我有一个 div,我想在单击“查看更多详细信息”按钮时显示它,然后我想在单击“查看更少详细信息”按钮时隐藏它。
What is the best way using Laravelto hide and show a particular div without using jqueryto do this? Is there a similar way to accomplish this to how Angular does?
使用Laravel隐藏和显示特定 div而不使用 jquery的最佳方法是什么?是否有与 Angular 类似的方法来实现这一点?
<div class="details"></div>
<a href="">See Less Details</a>
<a href="">See More Details</a>
采纳答案by ITDesigns.eu
Here is inline version for it:
这是它的内联版本:
<div class="details" style="display:none">HIDDEN CONTENT</div>
<a id="more" href="#" onclick="$('.details').slideToggle(function(){$('#more').html($('.details').is(':visible')?'See Less Details':'See More Details');});">See More Details</a>
Check it out on jsFiddle