Показать сообщение отдельно
  #3 (permalink)  
Старый 21.05.2015, 18:09
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,070

Sanu0074,
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
  <script>
     $(function(){
    $.Nav = {
        init: function(){
            return this;
        },

        begin: function(){
            alert('begin nav');
        },

        destroy: function(){
            alert('destroy nav');
        }
    }

    $.Nav2x = {
        init: function(){
            return this;
        },

        begin: function(){
            alert('begin Nav2x');
        },

        destroy: function(){
            alert('destroy Nav2x');
        }
    }

    $.Nav3x = {
        init: function(){
            return this;
        },

        begin: function(){
            alert('begin Nav3x');
        },

        destroy: function(){
            alert('destroy Nav3x');
        }
    }
   var params = ["Nav3x","Nav2x"];
   function test(params,metod)
   {
      $.each(params, function(){
         $[this][metod]()
         });
   }
  function toDo(){
       test(params,'begin')
	}

	function toStop(){
		test(params,'destroy')
	}
  toDo()
  toStop()
});




  </script>
Ответить с цитированием