欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實現(xiàn)的彈幕效果完整實例

 更新時間:2017年09月06日 11:33:52   作者:lucky芬  
這篇文章主要介紹了jQuery實現(xiàn)的彈幕效果,結(jié)合完整實例形式分析了jQuery通過結(jié)合時間函數(shù)控制輸入文字與樣式的漸變實現(xiàn)彈幕效果,需要的朋友可以參考下

本文實例講述了jQuery實現(xiàn)的彈幕效果。分享給大家供大家參考,具體如下:

看視頻的時候老是會出現(xiàn)一些彈幕,對于這個看著很高大上的特效,其實也不難實現(xiàn)。

先來看看運行效果:

下面將整個代碼顯示出來:

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>www.dbjr.com.cn彈幕</title>
<style type="text/css">
  html,body{
    background:#efefef;
    height:100%;
  }
  .danmu{
    width: 100px;
    height:30px;
    line-height: 28px;
    background: green;
    border-radius: 5px;
    border:1px solid #fff;
    color: #fff;
    outline: none;
  }
  div.mask{
    position:fixed;
    width:100%;
    height:100%;
    background:rgba(0,0,0,0.8);
    opacity:0.5;
    top:0px;
    left:0px;
  }
  div.bottom{
    width:100%;
    height:77px;
    background:linear-gradient(#ccc,#4a4a4a);
    position:fixed;
    bottom:0px;
    left:0px;
    text-align:center;
    line-height:77px;
  }
  div.bottom input.content{
    width:50%;
    min-width: 200px;
    height:37px;
    border:none;
    border-radius:10px 0px 0px 10px;
    font-size:16px;
    padding:0 10px;
    outline:none;
  }
  div.bottom a.send{
    background-color:green;
    color:#fff;
    display:inline-block;
    width:100px;
    height:38px;
    line-height:37px;
    text-align:center;
    position:relative;
    left:-10px;
    top:2px;
    border-radius:0px 10px 10px 0px;
    text-decoration:none;
    font-family:'Microsoft Yahei';
  }
  div.mask a.button{
    width:30px;
    height:30px;
    border-radius:50%;
    background-color:green;
    color:#fff;
    position:fixed;
    top:20px;
    right:20px;
    text-align:center;
    line-height:30px;
    font-size:20px;
    font-family:'Microsoft Yahei';
    border:1px solid #fff;
    text-decoration:none;
    cursor:pointer;
  }
  div.text{
    color:#fff;
    position:fixed;
    right:0px;
    font-size:20px;
    white-space: nowrap;
  }
</style>
</head>
<body>
<button class="danmu">彈幕技術(shù)</button>
  <div class="mask">
    <a href="#" rel="external nofollow" rel="external nofollow" class="button">X</a>
  </div>
  <!-- 底部發(fā)言框前端 -->
  <div class="bottom">
    <input class="content"></input>
    <a href="#" rel="external nofollow" rel="external nofollow" class="send">發(fā)表言論</a>
  </div>
  <script type="text/javascript" src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  <script>
   $("a.send").click(function(){
  var val=$(".content").val();
  var content=$("<div class='text'>"+val+"</div>");
  var top=Math.random()*$(document.body).height()+40+"px";
  content.css("top",top);
  $(".mask").append(content);
  content.animate({right:$(document.body).width()+100},8000,function(){
  $(this).remove();
  })
  });
  $('.button').click(function(){
      $('div.mask').fadeOut(500);
    });
    $(".danmu").click(function(){
     $('div.mask').fadeIn(500);
  });
</script>
</body>
</html>

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery切換特效與技巧總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery擴展技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動畫與特效用法總結(jié)》、《jquery選擇器用法總結(jié)》及《jQuery常用插件及用法總結(jié)

希望本文所述對大家jQuery程序設(shè)計有所幫助。

相關(guān)文章

  • jquery捕捉回車鍵及獲取checkbox值與異步請求的方法

    jquery捕捉回車鍵及獲取checkbox值與異步請求的方法

    這篇文章主要介紹了jquery捕捉回車鍵及獲取checkbox值與異步請求的方法,實例分析了jQuery針對回車鍵的捕捉,checkbox值的獲取以及異步請求的響應(yīng)等相關(guān)技巧,需要的朋友可以參考下
    2015-12-12
  • EasyUI學習之Combobox級聯(lián)下拉列表(2)

    EasyUI學習之Combobox級聯(lián)下拉列表(2)

    這篇文章主要為大家詳細介紹了EasyUI學習之Combobox級聯(lián)下拉列表的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2016-12-12
  • jQuery的學習步驟

    jQuery的學習步驟

    首先我建議大家去看看<JQUERY實戰(zhàn)>這本書,稍后我會提供本書的jquery實戰(zhàn)PDF版本。能省點銀子最好啊。
    2011-02-02
  • JQuery toggle使用分析

    JQuery toggle使用分析

    今天針對這個JQuery里面的toggle聊幾句,文章中涉及到了一些問題望牛牛們能幫忙解惑一下。
    2009-11-11
  • jquery選擇器原理介紹($()使用方法)

    jquery選擇器原理介紹($()使用方法)

    這篇文章主要介紹了jquery選擇器原理介紹($()使用方法),需要的朋友可以參考下
    2014-03-03
  • jquery插件tytabs.jquery.min.js實現(xiàn)漸變TAB選項卡效果

    jquery插件tytabs.jquery.min.js實現(xiàn)漸變TAB選項卡效果

    這篇文章主要介紹了jquery插件tytabs.jquery.min.js實現(xiàn)漸變TAB選項卡效果,實例分析了tytabs.jquery.min.js插件實現(xiàn)tab選項卡切換效果的使用技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-08-08
  • 深入學習jQuery Validate表單驗證

    深入學習jQuery Validate表單驗證

    這篇文章主要針對jQuery Validate表單驗證為大家進行詳細介紹,如何在class屬性里面并定義錯誤信息的提示,感興趣的小伙伴們可以參考一下
    2016-01-01
  • jQuery彈簧插件編寫基礎(chǔ)之“又見彈窗”

    jQuery彈簧插件編寫基礎(chǔ)之“又見彈窗”

    本文通過具體實例給大家介紹jquery彈窗插件編寫基礎(chǔ)之又見彈簧的相關(guān)資料,對jquery彈簧插件編寫相關(guān)知識感興趣的朋友一起學習吧
    2015-12-12
  • jquery對元素拖動排序示例

    jquery對元素拖動排序示例

    對元素進行拖動排序的實現(xiàn)方法有很多,在本文為大家介紹下使用jquery來完成這個工作,希望對大家有所幫助
    2014-01-01
  • jQuery插件zTree實現(xiàn)刪除樹節(jié)點的方法示例

    jQuery插件zTree實現(xiàn)刪除樹節(jié)點的方法示例

    這篇文章主要介紹了jQuery插件zTree實現(xiàn)刪除樹節(jié)點的方法,結(jié)合實例形式分析了jQuery樹插件zTree針對節(jié)點的遍歷與刪除操作相關(guān)技巧,需要的朋友可以參考下
    2017-03-03

最新評論