56578

How can I access the inner functions of this script?

I'm pretty new to Javascript, and am trying to figure out how to get to some inner functions in the following script:

https://github.com/uikit/uikit/blob/cd959903879588740de2f883dde34a8b12a47cba/dist/js/uikit.js

Basically, I want to manually trigger the show and hide commands of Offcanvas, at line 859, to bring in an offcanvas menu in #offcanvas-nav.

To me, it looks like the outer namespace would be UI, so my first thought was to reference that in a new file, after that main uikit.js file is loaded

function staticShow() { var UI = $.UIkit || {}; var offcanvas_nav = jQuery.UIkit.offcanvas($('#offcanvas-nav'),{}); ... }

but I had no luck. Secondly I tried to access Offcanvas as a member of jQuery.UIkit but had similar results. How can I access the show/hide methods for the Offcanvas functions?

Another lesson I'd like to learn is what is happening at line 972,

})(jQuery, jQuery.UIkit, window.DocumentTouch);

I would bet my issues lie in not understanding that but I don't even know the Google phrase to search for. Thank you for any help.

Answer1:

line 972 is calling the anonymous function at line 851

(function($, UI, DocumentTouch) { //line 851 //omitted })(jQuery, jQuery.UIkit, window.DocumentTouch);//line 972

so within the function

    <li>$ = jQuery</li> <li>UI = jQuery.UIkit</li> <li>DocumentTouch = window.DocumentTouch</li> </ul>

    by looking at these lines

    OffcanvasTrigger.offcanvas = Offcanvas; //line 953 UI["offcanvas"] = OffcanvasTrigger; //line 955

    show should be available here: jQuery.UIkit.offcanvas.offcanvas.show

Recommend

  • Jasny bootstrap: Mobile View
  • Jasny Bootstrap change
  • Foundation 6 Off-canvas menu auto-close after click
  • TabBarController: Orienting views in different orientations
  • Yii2 disable highlighting menu item
  • UWP navigation (Template10), Pivot control, multiple frames
  • Declaration of does not work with Ionic's ion-nav-view in IBM MobileFirst
  • Change zIndex in HighChart
  • mysql table locked after php crashes
  • Excel passing a range into a function
  • Access Google Maps from outside
  • NHibernate proxyexception
  • Pointer vs Reference difference when passing Eigen objects as arguments
  • Get UILabel out of UIButton
  • c++ search a vector for element first seen position
  • Recreate the Oracle DUAL table
  • How dotnet build chooses the output name
  • Opaque reference instead of PImpl. Is it possible?
  • Can you pass an array from javascript to asp.net mvc controller action without using a form?
  • c++ regex_replace not doing intended substitution
  • using System.Speech.Synthesis with Windows10 universal app (XAML-C#)
  • Suppressing passwd when calling sqlplus from shell script
  • GAE: Way to get reference to an HttpSession from its ID?
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • Bypass multiple inheritance in Java
  • What is the purpose of TaskExecutor in spring?
  • wxPython: displaying multiple widgets in same frame
  • Tamper-proof configuration files in .NET?
  • How to Cache Real-time Data?
  • JQuery Internet Explorer and ajaxstop
  • Android full screen on only one activity?
  • Using $this when not in object context
  • Deleting and Updating values from a cusrsor adapter
  • How do I fake an specific browser client when using Java's Net library?
  • How reduce the height of an mschart by breaking up the y-axis
  • recyclerView does not call the onBindViewHolder when scroll in the view
  • Window Size for Mac application
  • Perl system calls when running as another user using sudo
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • coudnt use logback because of log4j