图中的小喇叭,鼠标点击即显示,但是网页源码里面看不到“onclick=”这样的字眼。请问加上“onclick=”的脚本在哪里?
用js实现的 载入页面时 动态添加的事件, 一般都用jQuery
截取部分代码,应该是绑定了class的点击事件
http://csdnimg.cn/rabbit/notev2/js/notify.js
self.on('panel_showed', function (e, showDetail) { var hasGet = false, unreadsData; self.resetPosition(); // 显示面板内容 if (unreads !== 0) { self.getUnreads(self.showListCbWrap(function (err, data, loading) { unreads = 0; unreadsData = data.data; })); hasGet = true; } if (!hasReadedItems) { $('.notice_content', self.Dom.wrap).empty(); self.getAllReaded(self.showListCbWrap(function (err, data, loading) { hasReadedItems = true; })); hasGet = true; } if (hasGet) { self.Dom.wrap.one('list_showed', function (e, err) { if (err) { self.error(err); } else { if(showDetail) { var unreadsItem = $('.notice_list_con .unread', self.Dom.wrap); if(unreadsItem.length === 1) { unreadsItem.trigger('click'); } } if (unreadsData && unreadsData.length > 0) { keepUnread = true; setTimeout(function() { self.setReaded(unreadsData); }, 1000); } } }); } }).on('detail_showed', function (e, detail, index) { // 显示通知详情 $('.detail_con .prvnote', self.Dom.wrap).toggleClass('disabled', !(index > 0)); $('.detail_con .nextnote', self.Dom.wrap).toggleClass('disabled', !detail.next()[0]); if (!detail.data('loaded') && !$('dd', detail)[0] && !$('.empty:visible', detail)[0] && !$('.loading:visible', detail)[0]) { self.getDetail(detail); } }).on('tip_showing', function () { keepUnread = false; if ($('.notice_list_con', self.Dom.wrap).css('display') !== 'none') { $('.notice_list_con .notice_content .unread', self.Dom.wrap).removeClass('unread'); } if (unreads > 0) { self.resetPosition(); $('strong', self.Dom.tip.show()).html(unreads); } }).on('receive_unreads', function (e, data) { // 收到未读消息实时通知 typeof data === number unreads = (unreads === -1 ? 0 : unreads) + data; if (self.Dom.wrap.is(':visible')) { if($('.notice_list_con', self.Dom.wrap).is(':visible')){ self.emit('panel_showed'); } } else { self.emit('tip_showing'); } }).on('receive_setreaded', function (e, data) { // 收到设置为已读实时通知 typeof data === array or number if (keepUnread) { } else { // TODO 如果焦点在当前浏览器窗口,什么都不做 // 非查看窗口收到已读通知时需要重置状态,以便再次打开时能正确显示通知 unreads = -1; hasReadedItems = false; } var num = /*$.isArray(data) ? unreads - data.length : typeof data === 'number' ? data : */0; if (num <= 0) { num = 0; self.Dom.tip.hide(); } $('strong', self.Dom.tip).html(num); }); $('.close2', self.Dom.tip).click(function () { self.Dom.tip.hide(); self.setReaded([], function(){ }); }); $('.tip_text', self.Dom.tip).click(function () { self.Dom.btn.trigger('click' // , ['Show one and only unread de