Prototype插件的切换属性用法
第一种方式:
;(function(window,$){ var athis, oPad=navigator.userAgent.toLowerCase().match(/iPad/i), //判断是否是ipad的浏览器 stouch=oPad ? "touchstart": "click", i=222; var popSide={ init:function(json){ this.popAMap=json, this.hotel=json.mapData, this.sgeocode=[], this.egeocode=[{ formattedAddress:this.hotel.fullname, location:popSide.toLngLat(this.hotel.pos, "|") }]; var J_routeSearch=$('#J_routeSearch'); console.log(this.routeSwitch); popSide.routeSwitch() //alert('rrr'); }, toLngLat:function(e, t) { return new CtripHotelMap_map.setLngLat(e); }, routeSwitch:function(t){ alert('触发第二个'); } }; window.CtripHotelMap_popSide = popSide })(window,jQuery); var currentInfo={ hotelId:hotelDomesticConfig.hotel.id } var CtripHotelMap_popAMap={ mapData:HotelMapStreetJson[currentInfo.hotelId] //id } new CtripHotelMap_popSide.init(CtripHotelMap_popAMap); !(function(window,$){ var i={ setLngLat:function(t){ alert('rrwwr'); } }; /*window.CtripHotelMap_map=function(t){ return new i(t); }*/ window.CtripHotelMap_map=i; })(window,jQuery);
结果输出了:
rrwwr
触发第二个
浙公网安备 33010602011771号