var PageNews = function(){ var $this = this, $window, $isTouch; $this.NAME = 'PageNews'; $this.config = { } $this.scale = 1; $this.blockAnimation = false; $this.prepare = function(){ trace( $this.NAME, "PREPARE" ); } $this.init = function(){ trace( $this.NAME, "INIT" ); $this.initMain(); $window.on('scroll', $this.scrollHandler); $this.scrollHandler(); } $this.load = function(){ trace( $this.NAME, "LOAD" ); } $this.resize = function(){ trace( $this.NAME, "RESIZE", $window.width() ); } $this.scrollHandler = function(){ var scrollTop = $window.scrollTop(); } $this.initMain = function(){ $('.btnMore').on('click', function(){ if( $(this).hasClass('active') ){ $(this).removeClass('active'); $(this).closest('.newsItem').find('.newsContent').hide(); }else{ $(this).addClass('active'); $(this).closest('.newsItem').find('.newsContent').show(); } }); } $this.retriveAjax = function(data){ if( data.action ){ switch( data.action ){ } } } var prepareHandler = function(_window, _isTouch){ $window = _window; $isTouch = _isTouch; $this.prepare(); } var initHandler = function(){ $this.init(); } var resizeHandler = function(){ $this.resize(); } var loadHandler = function(){ $this.load(); } $this.clearData = function($div){ var attrs = $div[0].attributes, name, index; for (index = attrs.length - 1; index >= 0; --index) { name = attrs[index].nodeName; if( name.indexOf("data-") > -1 ) { $div.removeAttr(name); } } } return { init: initHandler, resize: resizeHandler, load: loadHandler, prepare: prepareHandler }; }