给网站添加小姐姐视频教程

引言:

在网站侧边添加一个小姐姐随机跳舞的可折叠组件,这个组件的特点是,当用户点击时,会随机播放小姐姐的舞蹈视频。这样的设计不仅可以增加网站的趣味性,也可以吸引更多的用户停留和浏览。

代码:

<div>
<section id="main">
<video id="player" src="http://你的网址/video.php" controls="controls" width="100%" height="400px"></video>
</section>
</div>
<div style="text-align: center;">
<section id="buttons">
<button id="switch">连续: 开</button>
<button id="next1">换一个</button>
</section>
</div>
<script>
(function (window, document) {
if (top != self) {
window.top.location.replace(self.location.href);
}
var get = function (id) {
return document.getElementById(id);
}
var bind = function (element, event, callback) {
return element.addEventListener(event, callback);
}
var auto = true;
var player = get('player');
var randomm = function () {
player.src = 'http://你的网址/video.php?_t=' + Math.random();
player.play();
}
bind(get('next1'), 'click', randomm);
bind(player, 'error', function () {
randomm();
});
bind(get('switch'), 'click', function () {
auto = !auto;
this.innerText = '连续: ' + (auto ? '开' : '关');
});
bind(player, 'ended', function () {
if (auto) randomm();
});
})(window, document);</script>
<style>
#switch,#next1{
background: #7F9CCC;
color:#fff;
line-height:40px;
text-align:center;
width:100px;
border:none;
margin:0 6px;
border-radius:6px;
font-weight:bold;
}
</style>

小姐姐视频源码你也可以用我的:https://www.haizimeiti.com/api/xjj/

文章声明

1、文章来源于互联网,仅供学习交流使用,严禁用于商业用途,法律后果自行承担。
2、若文章中有侵权或不适当内容,请告知本站会第一时间进行处理 免责申明。

 
admin
  • 我们提供有偿技术支持
  • 转载请务必保留本文链接:https://www.dktxm.com/2108.html

发表评论