Wednesday 15 January 2014

How to add values on Javascript? -


I am beginning a lot on this and I am thinking that I can add these two values ​​ < Pre> MaximumscreenWidth: 480, Menu Title: 'Menu:'

In this script. function dropdown (L) {this.mainNav = el; This.initEvents (); } DropDown.prototype = {initEvents: function () {var obj = this; Obj.mainNav.on ('click', function (event) {$ (this) .toggleClass ('active'); event.stopPropagation ();}); }} $ (Function () {var mainNav = new dropdown ($ ('# menonave')); $ (document). Click (function () {// all dropdown $ ('. Dropdown-menu'). RemoveClass ('Active');});});

Thanks in advance.

  • In addition, this is the dropdown menu that I'm applying to my website.

    I am trying to apply this menu only for phone layout but it maintains its size even if the screen size is what it is.

    Itemprop = "text">

    If you want to add those properties, just add them as below:

      function dropdown (L, width, title) {this.mainNav = el; This.maxScreenWidth = width; // Added this.menuTitle = Title; // Added this.initEvents (); }   

    Now they are part of your constructor, as a passable argument

    Then when you call the constructor, then just those values ​​should be passed < / P>

      $ (function () {var mainNav = new DropDown ($ ('# mainNav'), 480, 'menu') // See, pass them here. $ (Document). Click (function () (/) All dropdown $ ('. Dropdown-menu'). RemoveClass ('active');});});    

    No comments:

    Post a Comment