ITPub博客

首页 > IT职业 > IT职场 > jQeury动态文字信息滚动,类似新浪微博

jQeury动态文字信息滚动,类似新浪微博

原创 IT职场 作者:chunzhisu 时间:2014-08-02 11:27:34 0 删除 编辑

点击(此处)折叠或打开

  1. <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
  2. <html xmlns=\"http://www.w3.org/1999/xhtml\">
  3. <head>
  4. <title>tweets-slide</title>
  5. <script type=\"text/javascript\" src=\"http://www.codefans.net/ajaxjs/jquery-1.4.2.min.js\"></script>
  6. <style type=\"text/css\" _mce_bogus=\"1\">
  7. <!--
  8. body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td { margin:0; padding:0; }
  9. body, button, input, select, textarea { font:12px/1.5 tahoma, arial, \\5b8b\\4f53; color:#666; }
  10. ul, ol { list-style:none; }
  11. a { text-decoration:none; }
  12. a:hover { text-decoration:underline; }
  13. body{background-color:#ECF5FF;}
  14. #wp{width:500px; height:400px; overflow:hidden; margin:20px auto; border:1px solid #333; background-color:#fff; position:relative;}
  15. .wp_con{padding:10px; border-bottom:1px dashed #333; background-color:#fff;}
  16. .wp_shade{background:url(wp_shade.png) 0 0 no-repeat; width:500px; height:45px; position:absolute; left:0; bottom:-1px; overflow:hidden;}
  17. -->
  18. </style>
  19. <script type=\"text/javascript\">
  20. (function(a) {
  21.     a.fn.slider = function(d) {
  22.         var g = {
  23.             sliderTime: 3000,
  24.             sliderEffect: \"shovedOff\", // sliderEffect每次变化的函数
  25.             coincide: true, // 控制先变化height后变化opacity的效果,false时类似于微博效果
  26.             mousePause: true, // 鼠标控制暂停与播放的事件,true时增加鼠标事件
  27.             itemFlag: \"\" // 增加HTML子类的附加属性,直接定义即可
  28.         };
  29.         var i = 0;
  30.         var b = a.extend(g, d);
  31.         var f = b.sliderTime;
  32.         var h = a(this);
  33.         if (b.mousePause) {
  34.             h.bind(\"mouseleave\",
  35.             function() {
  36.                 clearTimeout(i);
  37.                 i = setInterval(function() {
  38.                     c[b.sliderEffect]()
  39.                 },
  40.                 f)
  41.             });
  42.             h.bind(\"mouseenter\",
  43.             function() {
  44.                 clearTimeout(i)
  45.             })
  46.         }
  47.         var e = function() {
  48.             $s_first_child = h.find(\".\" + b.itemFlag + \":first-child\");
  49.             $s_last_child = h.find(\".\" + b.itemFlag + \":last-child\");
  50.             firstH = $s_first_child.height();
  51.             lastH = $s_last_child.height();
  52.         };
  53.         var c = {
  54.             shovedOff: function() {
  55.                 e();
  56.                 $s_last_child.css({
  57.                     opacity: 0,
  58.                     height: 0
  59.                 }).prependTo(h);
  60.                 if (!b.coincide) {
  61.                     $s_last_child.animate({
  62.                         height: lastH
  63.                     },
  64.                     800,
  65.                     function() {
  66.                         a(this).animate({
  67.                             opacity: 1
  68.                         },
  69.                         600)
  70.                     })
  71.                 } else {
  72.                     $s_last_child.css({
  73.                         opacity: 1
  74.                     }).animate({
  75.                         height: lastH
  76.                     },
  77.                     1200)
  78.                 }
  79.             }
  80.         };
  81.         i = setInterval(function() {
  82.             c[b.sliderEffect]()
  83.         },
  84.         f)
  85.     }
  86. })(jQuery);
  87. </script>
  88. </head>
  89. <body>
  90. <div id=\"wp\">
  91.     <div id=\"wp_inner\">
  92.         <div class=\"wp_con\">
  93.             NO.1 test!NO.1 test!NO.1 test!NO.1 test!NO.1 test!NO.1 test!NO.1 test!NO.1 test!NO.1 test!NO.1 test!
  94.         </div>
  95.         <div class=\"wp_con\">
  96.             NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!NO.2 test!
  97.         </div>
  98.         <div class=\"wp_con\">
  99.             NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!NO.3 test!
  100.         </div>
  101.         <div class=\"wp_con\">
  102.             NO.4 test!NO.4 test!NO.4 test!NO.4 test!NO.4 test!NO.4 test!NO.4 test!NO.4 test!NO.4 test!NO.4 test!NO.4 test!NO.4 test!
  103.         </div>
  104.         <div class=\"wp_con\">
  105.             NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!NO.5 test!
  106.         </div>
  107.         <div class=\"wp_con\">
  108.             NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!NO.6 test!
  109.         </div>
  110.         <div class=\"wp_con\">
  111.             NO.7 test!NO.7 test!NO.7 test!NO.7 test!NO.7 test!NO.7 test!NO.7 test!
  112.         </div>
  113.         <div class=\"wp_con\">
  114.             NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!NO.8 test!
  115.         </div>
  116.         <div class=\"wp_con\">
  117.             NO.9 test!NO.9 test!NO.9 test!NO.9 test!NO.9 test!NO.9 test!NO.9 test!NO.9 test!NO.9 test!NO.9 test!NO.9 test!NO.9 test!
  118.         </div>
  119.         <div class=\"wp_con\">
  120.             NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!NO.10 test!
  121.         </div>
  122.     </div>
  123.     <div class=\"wp_shade\" style=\"_filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'wp_shade.png\', sizingMethod=\'scale\');_background-image:none;\"></div>
  124.     <!-- src不支持相对路径,使用绝对路径 -->
  125. </div>
  126. <script type=\"text/javascript\">
  127. $(\'#wp_inner\').slider({
  128.     sliderTime:4000,
  129.     coincide:false
  130. });
  131. </script>
  132. </body>
  133. </html>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29737856/viewspace-1244162/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2014-07-04

  • 博文量
    95
  • 访问量
    122215