小修改
This commit is contained in:
1 parent
c94ec010f0
commit
7bf45a97f0
3 files changed
+109
-2
No files matched your search
@@ -9,9 +9,9 @@
|
||||
<link rel="stylesheet" href="/css/uikit.min.css">
|
||||
<link rel="stylesheet" href="/css/nprogress.min.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/@waline/client@v3/dist/waline.css" />
|
||||
<link rel="stylesheet" href="https://usj.cc/usr/themes/Ying/css/barrager.css">
|
||||
<link rel="stylesheet" href="/css/barrager.css">
|
||||
<script src="/js/jquery.min.js"></script>
|
||||
<script src="https://usj.cc/usr/themes/Ying/js/jquery.barrager.js"></script>
|
||||
<script src="/js/jquery.barrager.js"></script>
|
||||
<script src="/js/jquery.scrollUp.min.js"></script>
|
||||
<script src="/js/pjax.js"></script>
|
||||
{{ if or (eq .Type "about") (eq .Type "post") }}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
.barrage{position: fixed;bottom:70px;right:-500px;display: inline-block;width: 500px;z-index: 1}
|
||||
.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(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;}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*!
|
||||
*@name jquery.barrager.js
|
||||
*@author yaseng@uauc.net
|
||||
*@url https://github.com/yaseng/jquery.barrager.js
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.barrager = function(barrage) {
|
||||
barrage = $.extend({
|
||||
close:true,
|
||||
bottom: 0,
|
||||
max: 10,
|
||||
speed: 6,
|
||||
color: '#fff',
|
||||
old_ie_color : '#000000'
|
||||
}, barrage || {});
|
||||
|
||||
var time = new Date().getTime();
|
||||
var barrager_id = 'barrage_' + time;
|
||||
var id = '#' + barrager_id;
|
||||
var div_barrager = $("<div class='barrage' id='" + barrager_id + "'></div>").appendTo($(this));
|
||||
var window_height = $(window).height() - 100;
|
||||
var bottom = (barrage.bottom == 0) ? Math.floor(Math.random() * window_height + 40) : barrage.bottom;
|
||||
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>");
|
||||
var 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>");
|
||||
|
||||
}
|
||||
|
||||
var content = $("<a class='text-overflow'></a>").appendTo(id + " .barrage_box .p");
|
||||
content.attr({
|
||||
'id': barrage.id
|
||||
}).empty().append(barrage.info);
|
||||
if(navigator.userAgent.indexOf("MSIE 6.0")>0 || navigator.userAgent.indexOf("MSIE 7.0")>0 || navigator.userAgent.indexOf("MSIE 8.0")>0 ){
|
||||
|
||||
content.css('color', barrage.old_ie_color);
|
||||
|
||||
}else{
|
||||
|
||||
content.css('color', barrage.color);
|
||||
|
||||
}
|
||||
|
||||
var i = 0;
|
||||
div_barrager.css('margin-right', i);
|
||||
var looper = setInterval(barrager, barrage.speed);
|
||||
|
||||
function barrager() {
|
||||
|
||||
|
||||
var window_width = $(window).width() + 500;
|
||||
if (i < window_width) {
|
||||
i += 1;
|
||||
|
||||
$(id).css('margin-right', i);
|
||||
} else {
|
||||
|
||||
$(id).remove();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
div_barrager_box.mouseover(function() {
|
||||
clearInterval(looper);
|
||||
});
|
||||
|
||||
div_barrager_box.mouseout(function() {
|
||||
looper = setInterval(barrager, barrage.speed);
|
||||
});
|
||||
|
||||
$(id+'.barrage .barrage_box .close').click(function(){
|
||||
|
||||
$(id).remove();
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
$.fn.barrager.removeAll=function(){
|
||||
$('.barrage').remove();
|
||||
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
Reference in new issue
Block a user