公告代码①

2016-02-26
公告
欢迎访问快站代码daima.kuaizhan.com,如有意见建议请到社区留言反馈给我们!
  • 本站代码多来源于快站论坛
  • 谢谢大家的分享,这里一并感谢
  • 代码都经过测试、也有演示
  • 欢迎留言分享好的代码

本页可以观看本代码的效果。复制本例代码替换掉快站js控件中原来的代码,更新页面就可以看到效果了。
互助交流Q群:3036979。多谢关注
快站代码http://daima.kuaizhan.com

另有云商店公告组件(拖拽式管理),查看演示

代码1:
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="padding-left: 8px; padding-right: 8px;">    <tr>        <td width="50" height="50" bgcolor="#33CCCC" style="color:#FFFFFF"><center>公告</center></td>        <td height="50" bgcolor="#ececec">            <marquee scrollamount="10" style="color:#33CCCC">                欢迎访问快站代码daima.kuaizhan.com,如有意见建议请到社区留言反馈给我们!            </marquee>        </td>    </tr></table></div><div class="mod mod-js"><!DOCTYPE html>

代码2:
<style>.BreakingNewsController{width:100%; overflow:hidden; background:#FFF; height:auto; position:relative;}.BreakingNewsController .bn-title{display:inline-block;float:left; padding:10px 20px; background:#fff; color:#FFF;}.BreakingNewsController ul{padding:0; margin:0; display:block; list-style:none; position:absolute; left:50px; right:50px;}.BreakingNewsController ul li{list-style:none; padding:10px 20px; display:none;}.BreakingNewsController ul li a{text-decoration:none; color:#333; display:inline-block; overflow:hidden; padding:0;}.demo { width: 1000px; margin: 0 auto;}.demo1 { margin-top: 100px;}.demo2, .demo3 { margin-top: 0px;}</style><script src="http://www.jsdaima.com/Public/js/jquery-1.7.2.min.js"></script><script>$(function(){ $('#breakingnews3').BreakingNews({  timer: 2000,  effect: 'slide' });});</script><div class="demo demo3"> <div class="BreakingNewsController easing" id="breakingnews3">  <div class="bn-title"></div><ul><li>本站代码多来源于快站论坛</li><li>谢谢大家的分享,这里一并感谢</li><li>代码都经过测试、也有演示</li><li>欢迎留言分享好的代码</li></ul> </div></div><script>(function(jQuery){$.fn.BreakingNews = function(settings){var defaults={background:'#FFF',title:'公告:',titlecolor:'#000',titlebgcolor:'#ffffff',linkcolor:'#333',linkhovercolor:'#5aa628',fonttextsize:16,isbold:false,border:'none',width:'100%',autoplay:true,timer:3000,modulid:'brekingnews',effect:'fade'//or slide};var settings=$.extend(defaults,settings);return this.each(function(){settings.modulid="#"+$(this).attr("id");var timername=settings.modulid;var activenewsid=1;if (settings.isbold==true)fontw='bold';elsefontw='normal';if (settings.effect=='slide')$(settings.modulid+' ul li').css({'display':'block'});else$(settings.modulid+' ul li').css({'display':'none'});$(settings.modulid+' .bn-title').html(settings.title);$(settings.modulid).css({'width':settings.width, 'background':settings.background, 'border':settings.border, 'font-size':settings.fonttextsize });$(settings.modulid+' ul').css({'left':$(settings.modulid+' .bn-title').width()+40});$(settings.modulid+' .bn-title').css({'background':settings.titlebgcolor,'color':settings.titlecolor,'font-weight':fontw});$(settings.modulid+' ul li a').css({'color':settings.linkcolor,'font-weight':fontw,'height':parseInt(settings.fonttextsize)+6});$(settings.modulid+' ul li').eq( parseInt(activenewsid-1) ).css({'display':'block'});// Links hover events ......$(settings.modulid+' ul li a').hover(function(){                    $(this).css({'color':settings.linkhovercolor});},function (){$(this).css({'color':settings.linkcolor});});// Arrows Click Events ......$(settings.modulid+' .bn-arrows span').click(function(e) {                    if ( $(this).attr('class')=="bn-arrows-left" )BnAutoPlay('prev');elseBnAutoPlay('next');                });// Timer events ...............if (settings.autoplay==true){timername=setInterval(function(){BnAutoPlay('next')},settings.timer);$(settings.modulid).hover(function(){clearInterval(timername);},function(){timername=setInterval(function(){BnAutoPlay('next')},settings.timer);});}else{clearInterval(timername);}//timer and click events function ...........function BnAutoPlay(pos){if ( pos=="next" ){if ( $(settings.modulid+' ul li').length>activenewsid )activenewsid++;elseactivenewsid=1;}else{if (activenewsid-2==-1)activenewsid=$(settings.modulid+' ul li').length;elseactivenewsid=activenewsid-1;}if (settings.effect=='fade'){$(settings.modulid+' ul li').css({'display':'none'});$(settings.modulid+' ul li').eq( parseInt(activenewsid-1) ).fadeIn();}else{$(settings.modulid+' ul').animate({'marginTop':-($(settings.modulid+' ul li').height()+20)*(activenewsid-1)});}}// links size calgulating function ...........$(window).resize(function(e) {                    if ( $(settings.modulid).width()<360 ){$(settings.modulid+' .bn-title').html(' ');$(settings.modulid+' .bn-title').css({ 'width':'4px', 'padding':'10px 0px'});$(settings.modulid+' ul').css({'left':4});}else{$(settings.modulid+' .bn-title').html(settings.title);$(settings.modulid+' .bn-title').css({ 'width':'auto', 'padding':'10px 20px'});$(settings.modulid+' ul').css({'left':$(settings.modulid+' .bn-title').width()+40});}                });});};})(jQuery);</script>