jquery - custom Component register javascript.. getting weird Uncaught TypeError -
i working on new template.which contains api called panel actions. enables create action icons on bootstrap panel. want load thesee panels dynamically..what meant after complete page loading want add new panels these action.but when gives me error
$.components.register("panel", { api: function() { $(document).on('click.site.panel', '[data-toggle="panel-fullscreen"]', function(e) { e.preventdefault(); var $this = $(this), $panel = $this.closest('.panel'); var api = $panel.data('panel-api'); api.togglefullscreen(); });});
this how panel api in javascript..and here panel in html
<div class="panel is-collapse"> <div class="panel-heading"> <h3 class="panel-title">panel tool</h3> <div class="panel-actions"> <div class="dropdown"> <a class="dropdown-toggle panel-action" data-toggle="dropdown" href="#" aria-expanded="false"><i class="icon wb-settings" aria-hidden="true"></i></a> <ul class="dropdown-menu bullet" role="menu"> <li role="presentation"><a href="javascript:void(0)" role="menuitem"><i class="icon wb-flag" aria-hidden="true"></i> action</a></li> <li role="presentation"><a href="javascript:void(0)" role="menuitem"><i class="icon wb-print" aria-hidden="true"></i> action</a></li> <li role="presentation"><a href="javascript:void(0)" role="menuitem"><i class="icon wb-heart" aria-hidden="true"></i> else here</a></li> <li role="presentation"><a href="javascript:void(0)" role="menuitem"><i class="icon wb-share" aria-hidden="true"></i> separated link</a></li> </ul> </div> <a class="panel-action icon wb-refresh" data-toggle="panel-refresh" data-load-type="round-circle" data-load-callback="customrefreshcallback" aria-hidden="true"></a> <a class="panel-action icon wb-plus" data-toggle="panel-collapse" aria-expanded="true" aria-hidden="true"></a> <a class="panel-action icon wb-expand" data-toggle="panel-fullscreen" aria-hidden="true"></a> <a class="panel-action icon wb-close" data-toggle="panel-close" aria-hidden="true"></a> </div> </div> <div class="panel-body"> </div> </div>
when load these dynamically gives error saying 'undefined' eg:uncaught typeerror: cannot read property 'togglefullscreen' of undefined
first, panel-api
isn't defined anywhere in html on of components. secondly, you're getting property, not loading library, togglefullscreen
wouldn't exist call. looks you're missing intermediate step here.
Comments
Post a Comment