Specifically I have a Dropdown. I've been trying out new things from here. The same link shows some method such as 'onOpenStart', 'onOpenClose', and many more which are basically events of the dropdown.
The tutorial is vague. There is no demonstration how to use those events. I tried every syntax in jQuery to utilize those events but none of them worked and Chrome Dev Console shows me error that the used method does not exists on jQuery. I just want someone to point me to a document or show me how to use those events in jQuery.
My Code that did not work:
JS(jQuery):
$(document).ready(function(){
console.log("Ready");
$('.sidenav').sidenav();
$("#one").click(function(){
$('.sidenav').sidenav('open');
});
$(".dropdown-trigger").dropdown();
$("#dropdown1").dropdown('onOpenStart');
});
HTML:
<!-- Dropdown Structure -->
<ul id='dropdown1' class='dropdown-content'>
<li><a href="#!">one</a></li>
<li><a href="#!">two</a></li>
<li class="divider" tabindex="-1"></li>
<li><a href="#!">three</a></li>
<li><a href="#!"><i class="material-icons">view_module</i>four</a></li>
<li><a href="#!"><i class="material-icons">cloud</i>five</a></li>
</ul>
<!-- Trigger Button -->
<a data-target="dropdown1" class="dropdown-trigger" href="mobile.html"><i class="material-icons">more_vert</i></a>
onOpenStart is an Option, you can use it this way:
$('#dropdown1').dropdown({
hover: true,
onOpenClose: function () {
},
onOpenStart: function () {
//code
}
});
simple json format :)