Is this a defined method or property? _html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:40:46
Original
1153 people have browsed it

var pageController = {
init: function () {
this.featureBtnInit(); // Function button initialization
},
featureBtnInit: function () { //Function button
var $featureBtn = $("#featureBtn");
var openClass = "btn-feature-open";
if (!$featureBtn[0])return this;
$featureBtn.on ( "click", function () {
if(!$featureBtn.hasClass(openClass)){
$featureBtn.addClass(openClass);
}else{
         $featureBtn.removeClass(openClass) ;
         } 
           }); [0]) {
                             $featureBtn.removeClass(openClass);                                 ===== ============= Page starts ================== */
$(function () {
pageController.init ();
})

Question:
Are "init" and "featureBtnInit" defined attributes or methods? ? ?                                                                                                                                             Why do we need to define 2 methods? You can just define a Function function. What are the benefits of defining it this way? ? ?





Reply to discussion (solution)

http://www.cnblogs.com/kuikui/archive/2013/07/14/ 3190381.html

1. Attributes. But properties are methods.

2. This defines the structure clearly. Methods can be called differently.

Not two methods, just methods that can call attributes. . .
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template