Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
voidpls authored May 22, 2020
1 parent ae0ef80 commit c9f1bd5
Showing 1 changed file with 26 additions and 24 deletions.
50 changes: 26 additions & 24 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
//function init(bgNum) {
// let bgAddr = `files/bg/rain${bgNum}.gif`
function init(bgNum) {
let bgAddr = `files/bg/rain${bgNum}.gif`

//$('<img/>')
//.attr('src', bgAddr)
//.on('load', function() {
//$(this).remove()
//$('#bg').css('background-image', "url('" + bgAddr + "')")
//let song = new Audio('files/H E R B - Moving.mp3')
//song.loop = true
//song.volume = 0.75
//song.play()
//})
//}
$('<img/>')
.attr('src', bgAddr)
.on('load', function() {
$(this).remove()
$('#bg').css('background-image', "url('" + bgAddr + "')")
// let song = new Audio('files/H E R B - Moving.mp3')
// song.loop = true
// song.volume = 0.75
// song.play()
})
}

//let bgNum = ~~(Math.random() * 6) + 1
//init(bgNum)
const bgs = [1,2,3,5,6]
const bgNum = bgs[bgs.length]
// let bgNum = ~~(Math.random() * 6) + 1
init(bgNum)

$(document).ready(function() {
// $("#bgndVideo").mb_YTPlayer();
Expand All @@ -28,13 +30,13 @@ $(document).ready(function() {
duration: 400
})
})
var videoWidth = 1280;
var videoHeight = 720;
var video = $(".video-container video").attr("srcdesk");
if($(window).width() < 721) {
videoWidth = 480;
videoHeight = 854;
video = $(".video-container video").attr("srcmob");
}
$(".video-container video").attr("width", videoWidth).attr("height", videoHeight).append('<source src="' + video + '" type="video/mp4" >')
// var videoWidth = 1280;
// var videoHeight = 720;
// var video = $(".video-container video").attr("srcdesk");
// if($(window).width() < 721) {
// videoWidth = 480;
// videoHeight = 854;
// video = $(".video-container video").attr("srcmob");
// }
// $(".video-container video").attr("width", videoWidth).attr("height", videoHeight).append('<source src="' + video + '" type="video/mp4" >')
})

0 comments on commit c9f1bd5

Please sign in to comment.