$(function(){ var $win = $(window), mapw = 0, winh = $win.height(), winw = $win.width(), $bodycontainer = $('#bodycontainer'), $extendmap = $('#extendmap'); // 导航功能 var navobj = { wrap: $('#navwrap'), init: function() { this.events(); }, events: function() { var that = this; that.wrap.on('mouseover', 'li', function() { var $this = $(this); $this.addclass('active'); }).on('mouseout','li', function () { var $this = $(this); $this.removeclass('active'); }); } }; // 地图页面功能 var mapobj = { extendmapwrap: $('#extendmap .baidu-map'), sidew: $('#extendmap .map-list').width(), init: function() { this.events(); this.resize(); }, resize: function() { var that = this; $win.on('resize onload', function() { winh = $win.height(); winw = $win.width(); mapw = winw > 600 ? (winw - that.sidew) : (600 - that.sidew); that.extendmapwrap.width(mapw - 3).height(winh); }); }, events: function() { var that = this; $('#extendbtn').on('click', function(e) { e.preventdefault(); winh = $win.height(); winw = $win.width(); $bodycontainer.hide(); // 重设百度地图的高度 mapw = winw > 600 ? (winw - that.sidew) : (600 - that.sidew); that.extendmapwrap.width(mapw - 3).height(winh); $extendmap.show(); }); $('#shrinkbtn').on('click', function(e) { e.preventdefault(); $bodycontainer.show(); $extendmap.hide(); }); } }; var selectobj = { selectoption: $('.select-option', $extendmap), init: function() { this.events(); }, showselect: function(elem) { this.selectoption.hide(); elem.show(); }, selectedarea: function(elem, index, curoption) { var $simulateselect = elem.parents('.simulate-select'), $headerinput = $('.header-input', $simulateselect); curoption.hide(); $('li', curoption).removeclass('active').eq(index).addclass('active'); $headerinput.val(elem.text()); }, events: function() { var that = this; $extendmap.on('click', '.select-header', function() { var $this = $(this), $option = $this.parents('.simulate-select').find('.select-option'); that.showselect($option); }); that.selectoption.on('click', 'li', function() { var $this = $(this), index = $this.index(), $curseloption = $this.parents('.select-option'); that.selectedarea($this, index, $curseloption); }); } }; navobj.init(); mapobj.init(); selectobj.init(); //处理容器里模块为空的情况 $.each($("[id][runat=server][default=true]"), function() { dealdefaultpanelbackground($(this)); } ); });