Coder Social home page Coder Social logo

barrage's Introduction

barrage

弹幕(适用于评论,留言,打赏等)

默认数据格式为

    var data = [
      {href : 'http://fy.035k.com',text : '我的博客http://fy.035k.com'},
      {href : 'http://www.baidu.com',text : '百度'},
      {href : 'http://www.imooc.com',text : '慕课网'},
      {href : 'http://www.jq22.com',text : 'jquery插件网'},
      {href : 'http://www.035k.com',text : '苏打绿可根据历史'},
      {href : '',text : '死垃圾管理数据管理'},
      {href : '',text : '另外今年光缆和并购水晶宫老师'}
    ]

data为数据,数据格式可调换,更改数据格式时,记得去改源码中的36行

数据初始化

    var Obj = $('body').barrage({
            data : data, //数据列表
	row : 5,   //显示行数
	time : 2500, //间隔时间
	gap : 20,    //每一个的间隙
	position : 'fixed', //绝对定位
	direction : 'bottom right', //方向
	ismoseoverclose : true, //悬浮是否停止
	height : 30, //设置单个div的高度
    })

开始弹幕方法

    Obj.start(); 

添加弹幕方法

   //添加评论
  $("#submit_barraget").click(function(){

    var val = $("#barrage_content").val();
    //此格式与data.js的数据格式必须一致
    var addVal = {
      href : '',
      text : val
    }
    //添加进数组
    Obj.data.unshift(addVal);
    alert('评论成功');

  })

关闭弹幕方法

  Obj.close();

barrage's People

Contributors

515184405 avatar

Stargazers

 avatar  avatar cbimhuangsir avatar  avatar Sns avatar Starry Path avatar White(徐广超) avatar 虾兄 avatar  avatar  avatar LIXIAOYAO avatar 贝多叶 avatar  avatar Yuanfang Xu avatar 小莫唐尼 avatar  avatar Hiroshi.tao avatar

Watchers

James Cloos avatar  avatar

barrage's Issues

direction改为top的时候滚动样式错乱

direction改为top的时候滚动样式错乱
我觉得应该把index.js的第60行改为这样更合适。
var index=0;
if(M.vertical == 'top'){
index=M.barrageBox.children().length -1;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.