javascript - Materialize css collapsible make disabled - Stack Overflow

Using Materialize CSS within Laravel, and depending on certain situations I wanted to be able to disabl

Using Materialize CSS within Laravel, and depending on certain situations I wanted to be able to disabled "Collapsible" elements, like you can easily with "Tabs" by adding the class of "disabled" should you need to, e.g:

<li @if(count($devices) == 0) class="tab col s4 disabled" @else class="tab col s4" @endif><a href="#mydevices">My Devices</a></li>

Tab Elements: MaterializeCSS Tabs

Collapsible Elements: MaterializeCSS Collapsible

But this doesn't work for collapsible elements. The workaround is just to hide the whole element but disabling shows the user what they potentially could get to where they to do more etc.

So this is the bit I'm trying to make disabled:

<div @if(count($devices) == 0) class="collapsible-header disabled" @else class="collapsible-header" @endif>My Devices</div>

Thoughts / Ideas appreciated :)

Using Materialize CSS within Laravel, and depending on certain situations I wanted to be able to disabled "Collapsible" elements, like you can easily with "Tabs" by adding the class of "disabled" should you need to, e.g:

<li @if(count($devices) == 0) class="tab col s4 disabled" @else class="tab col s4" @endif><a href="#mydevices">My Devices</a></li>

Tab Elements: MaterializeCSS Tabs

Collapsible Elements: MaterializeCSS Collapsible

But this doesn't work for collapsible elements. The workaround is just to hide the whole element but disabling shows the user what they potentially could get to where they to do more etc.

So this is the bit I'm trying to make disabled:

<div @if(count($devices) == 0) class="collapsible-header disabled" @else class="collapsible-header" @endif>My Devices</div>

Thoughts / Ideas appreciated :)

Share Improve this question asked Mar 25, 2016 at 13:50 WebTimWebTim 2476 silver badges11 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

I'm not a "Laravel" guy but I can propose you the following solution for HTML/JS/CSS:

<ul class="collapsible" data-collapsible="accordion">
    <li class="disabled">
      <div class="collapsible-header"><i class="material-icons">filter_drama</i>First</div>
      <div class="collapsible-body"><p>Lorem ipsum dolor sit amet.</p></div>
    </li>
    <li>
      <div class="collapsible-header"><i class="material-icons">place</i>Second</div>
      <div class="collapsible-body"><p>Lorem ipsum dolor sit amet.</p></div>
    </li>
    <li>
      <div class="collapsible-header"><i class="material-icons">whatshot</i>Third</div>
      <div class="collapsible-body"><p>Lorem ipsum dolor sit amet.</p></div>
    </li>
 </ul>

CSS:

.collapsible li.disabled .collapsible-body {
    display: none !important; /*or using id of the app to avoid the use of !important*/
}

.collapsible li.disabled .collapsible-header {
    background: rgb(221,221,221);
}

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

相关推荐

  • javascript - Materialize css collapsible make disabled - Stack Overflow

    Using Materialize CSS within Laravel, and depending on certain situations I wanted to be able to disabl

    14小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

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

关注微信