11/05/2018, 12:53
Mọi người Giúp thêm thẻ video bằng javascript
Mọi người trên diễn đàn Vforum giúp đỡ! thêm thẻ video : <video id="envideo"><source src="videoplayback.mp4" type="video/mp4"></video> vào this.create dưới như thế nào vậy mọi người? Mã: var Split = function() { this.$t = $("#demo"); ...
Mọi người trên diễn đàn Vforum giúp đỡ!
thêm thẻ video :
<video id="envideo"><source src="videoplayback.mp4" type="video/mp4"></video>
vào this.create dưới như thế nào vậy mọi người?
thêm thẻ video :
<video id="envideo"><source src="videoplayback.mp4" type="video/mp4"></video>
vào this.create dưới như thế nào vậy mọi người?
Mã:
var Split = function() { this.$t = $("#demo"); this.gridX = 16; this.gridY = 10; this.w = this.$t.awidth(); this.h = this.$t.height(); this.delay = 0.15; this.create = function() { $("div", this.$t).remove(); for (x = 0; x < this.gridX; x++) { for (y = 0; y < this.gridY; y++) { className = $("div", this.$t).attr('class', 'bounceInRight animated').attr('id', 'elvideo'); var awidth = this.w / this.gridX * 101 / this.w + "%", height = this.h / this.gridY * 101 / this.h + "%", top = this.h / this.gridY * y * 100 / this.h + "%", left = this.w / this.gridX * x * 100 / this.w + "%", bgPosX = -(this.w / this.gridX * x) + "px", bgPosY = -(this.h / this.gridY * y) + "px"; $("<div />") .css({ top: top, left: left, awidth: awidth, height: height, backgroundPosition: bgPosX + " " + bgPosY, backgroundSize: this.w + "px", animationDelay: x * this.delay + y * this.delay + "s" }).appendTo(this.$t); } } }; this.create(); this.$t .on("click", function() { $(this).toggleClass(""); }) .click(); };