如何在网站右下角增加悬浮公告栏

2016-07-07 16:06 来源:www.chinab4c.com 作者:ecshop专家

如何在网站右下角增加悬浮公告栏呢?如下图,请各位大侠帮帮忙

QQ截图未命名.jpg

回答:
他其实就是个客服代码改的吧!

增加一个js就好了,然后自己做个样式调用呗...
  1. function _message_node(id){return document.getElementById(id)}function _message_child(p,c){var pdom=_message_node(p);var nodes=pdom.childNodes;var cdom=false;for(var i=0;i<nodes.length;i++){if(nodes[i].tagName==c.toUpperCase()){cdom=nodes[i];break}}return cdom}function _message_tips_pop(act){var MsgPop=_message_child("_popup_msg_container","div");var MsgPop=null==MsgPop?document.getElementById("_popup_msg_container"):MsgPop;var popH=parseInt(MsgPop.clientHeight);if(act=="up"){MsgPop.style.display="block";show=setInterval("_message_changeH('up')",2)}if(act=="down"){hide=setInterval("_message_changeH('down')",2)}}function _message_changeH(str){var MsgPop=_message_child("_popup_msg_container","div");var MsgPop=null==MsgPop?document.getElementById("_popup_msg_container"):MsgPop;var popH=parseInt(MsgPop.clientHeight);if(str=="up"){if(popH<=240){MsgPop.style.height=(popH+4).toString()+"px"}else{clearInterval(show)}}if(str=="down"){if(popH>=8){MsgPop.style.height=(popH-4).toString()+"px"}else{MsgPop.style.display="none";clearInterval(hide)}}}var server=window.location.host;if(server.indexOf("local")<0) var p="1=1";if(window.location.search.indexOf("?")>-1){var p=window.location.search.substring(1)}
  2. var MsgPop=_message_child("_popup_msg_container","div");
  3. if(MsgPop){
  4. MsgPop.style.display="none";
  5. MsgPop.style.height="0px"
  6. }
  7. setTimeout("_message_tips_pop('up')",100);
复制代码

找一个js放到页脚模板里就可以了

别加这个,感觉用户体验很不好。