-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #653 from axh2018/develop
feat:将留言板处valine留言改为弹幕形式
- Loading branch information
Showing
7 changed files
with
292 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
.barrage { | ||
position: fixed; | ||
bottom: 70px; | ||
right: -500px; | ||
display: inline-block; | ||
width: 500px; | ||
z-index: 99999 | ||
} | ||
|
||
.barrage_box { | ||
background-color: rgba(0, 0, 0, .5); | ||
padding-right: 8px; | ||
height: 40px; | ||
display: inline-block; | ||
border-radius: 25px; | ||
transition: all .3s; | ||
} | ||
|
||
.barrage_box .portrait { | ||
display: inline-block; | ||
margin-top: 4px; | ||
margin-left: 4px; | ||
width: 32px; | ||
height: 32px; | ||
border-radius: 50%; | ||
overflow: hidden; | ||
} | ||
|
||
.barrage_box .portrait img { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.barrage_box div.p a { | ||
margin-right: 2px; | ||
font-size: 14px; | ||
color: #fff; | ||
line-height: 40px; | ||
margin-left: 18px; | ||
} | ||
|
||
.barrage_box div.p a:hover { | ||
text-decoration: underline; | ||
} | ||
|
||
.barrage_box .close { | ||
visibility: hidden; | ||
opacity: 0; | ||
text-align: center; | ||
width: 25px; | ||
height: 25px; | ||
margin-left: 20px; | ||
border-radius: 50%; | ||
background: rgba(255, 255, 255, .1); | ||
margin-top: 8px; | ||
background-image: url(/medias/barrager/close.png); | ||
} | ||
|
||
.barrage_box:hover .close { | ||
visibility: visible; | ||
opacity: 1; | ||
} | ||
|
||
.barrage_box .close a { | ||
display: block; | ||
} | ||
|
||
.barrage_box .close .icon-close { | ||
font-size: 14px; | ||
color: rgba(255, 255, 255, .5); | ||
display: inline-block; | ||
margin-top: 5px; | ||
} | ||
|
||
.barrage .z { | ||
float: left !important; | ||
} | ||
|
||
.barrage a { | ||
text-decoration: none; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
*@name jquery.barrager.js | ||
*@version 1.1 | ||
*@author [email protected] | ||
*@url https://github.com/yaseng/jquery.barrager.js | ||
*/ | ||
(function($) { | ||
$.fn.barrager = function(barrage) { | ||
barrage = $.extend({ | ||
close: true, | ||
max: 10, | ||
speed: 16, | ||
color: '#ffffff', | ||
}, barrage || {}); | ||
|
||
const time = new Date().getTime(); | ||
const barrager_id = 'barrage_' + time; | ||
const id = '#' + barrager_id; | ||
const div_barrager = $("<div class='barrage' id='" + barrager_id + "'></div>").appendTo($(this)); | ||
const this_height = $(window).height() * 0.35; | ||
const this_width = $(window).width() + 100; | ||
const array = [ | ||
(this_height / 5) + $(window).height() * 0.5, | ||
2*(this_height / 5) + $(window).height() * 0.5, | ||
3*(this_height / 5) + $(window).height() * 0.5, | ||
4*(this_height / 5) + $(window).height() * 0.5, | ||
5*(this_height / 5) + $(window).height() * 0.5 | ||
] | ||
const bottom =array[Math.floor(Math.random()*5)]; | ||
|
||
div_barrager.css("bottom", bottom + "px"); | ||
div_barrager_box = $("<div class='barrage_box cl'></div>").appendTo(div_barrager); | ||
if(barrage.img){ | ||
div_barrager_box.append("<a class='portrait z' href='javascript:;'></a>"); | ||
const img = $("<img src='' >").appendTo(id + " .barrage_box .portrait"); | ||
img.attr('src', barrage.img); | ||
} | ||
div_barrager_box.append(" <div class='z p'></div>"); | ||
if(barrage.close){ | ||
div_barrager_box.append(" <div class='close z'></div>"); | ||
} | ||
|
||
const content = $("<a title='' href='' target='_blank'></a>").appendTo(id + " .barrage_box .p"); | ||
content.attr({ | ||
'href': barrage.href, | ||
'id': barrage.id | ||
}).empty().append(barrage.info); | ||
content.css('color', barrage.color); | ||
|
||
const i = 0; | ||
div_barrager.css('margin-right', 0); | ||
|
||
$(id).animate({right:this_width},barrage.speed*1000,function() | ||
{ | ||
$(id).remove(); | ||
}); | ||
|
||
div_barrager_box.mouseover(function() | ||
{ | ||
$(id).stop(true); | ||
}); | ||
|
||
div_barrager_box.mouseout(function() | ||
{ | ||
$(id).animate({right:this_width},barrage.speed*1000,function() | ||
{ | ||
$(id).remove(); | ||
}); | ||
}); | ||
|
||
$(id+'.barrage .barrage_box .close').click(function() | ||
{ | ||
$(id).remove(); | ||
}) | ||
} | ||
|
||
|
||
$.fn.barrager.removeAll=function() | ||
{ | ||
$('.barrage').remove(); | ||
} | ||
|
||
})(jQuery); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.