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");
this.gridX = 16;
this.gridY = 10;
this.w = this.$t.width();
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 width = 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,
width: width,
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();
};
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.width();
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 width = 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,
width: width,
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();
};