效果展示
给网站侧边添加小姐姐随机跳舞可折叠组件,我用的系统是WordPress,别的程序也支持使用!
初始效果
![图片[1]-给网站侧边添加小姐姐随机跳舞可折叠组件-大海博客](https://www.dhme.cn/wp-content/uploads/2024/01/20240114212032734-20240114132032899456.webp)
使用效果
![图片[2]-给网站侧边添加小姐姐随机跳舞可折叠组件-大海博客](https://www.dhme.cn/wp-content/uploads/2024/01/20240114212109179-20240114132109563929.webp)
教程
以WordPress为例子,我们进入网站后台找到【外观】-【小工具】-【自定义HTML】,添加以下代码,如果不是WordPress,自己在想要的位置找到对应文件添加。
![图片[3]-给网站侧边添加小姐姐随机跳舞可折叠组件-大海博客](https://blog.wnzqc.com/wp-content/uploads/2023/08/c12387f049d13b8bf5337e1e825fa6a-1024x677.png)
代码
<section id="xiaojiejie"><div class="xiaojiejie"><style>#player { margin: 1px auto; max-width: 100%; border-radius: 10px; display: block; } #xjjsp { display: none; } #ckxjj,#gbxjj { width: 100%; height: 40px; border: none; background-color: #f95491; color: #fff; margin-top: 1px; border-radius: 5px; font-size: 18px; cursor: pointer; transition: 0.2s; } #ckxjj:hover,#gbxjj:hover { background-color: #eeb4bf; } .kzsp { width: 100%; display: flex; justify-content: space-between; } .kzsp>button { border: none; height: 40px; padding: 0 30px; font-size: 16px; background-color: #f95491; border-radius: 10px; color: #fff; transition: 0.3s; cursor: pointer; } .kzsp>button:active { background-color: #e25a00; }</style><button type="button" id="ckxjj">点我看小姐姐视频</button><div id="xjjsp"><video id="player" src="https://www.cunshao.com/666666/api/web.php" controls="" alt="小姐姐视频"></video><div class="kzsp"><button id="switch">连续: 开</button><button id="next">下一个</button></div><button type="button" id="gbxjj">关闭视频</button></div><script>var player = document.getElementById('player');var bind = function (element, event, callback) {return element.addEventListener(event, callback);};var sp = 0;$(document).ready(function () {$('#ckxjj').click(() => {$('#ckxjj').hide();$('#xjjsp').show();if (sp == 0) {randomm();sp = null}player.onerror = () => {randomm()}player.play();});$('#gbxjj').click(() => {$('#ckxjj').show();$('#xjjsp').hide();player.pause();})});var get = function (id) {return document.getElementById(id);};var auto = true;// 生成播放视频function randomm() {player.src = 'http://v.nrzj.vip/video.php';player.play();};bind(get('next'), 'click', randomm);bind(get('switch'), 'click', function () {auto = !auto;this.innerText = '连续:' + (auto ? '开' : '关');});bind(player, 'ended', function () {if (auto) randomm();});player.pause();</script></div></section><section id="xiaojiejie"> <div class="xiaojiejie"><style>#player { margin: 1px auto; max-width: 100%; border-radius: 10px; display: block; } #xjjsp { display: none; } #ckxjj,#gbxjj { width: 100%; height: 40px; border: none; background-color: #f95491; color: #fff; margin-top: 1px; border-radius: 5px; font-size: 18px; cursor: pointer; transition: 0.2s; } #ckxjj:hover,#gbxjj:hover { background-color: #eeb4bf; } .kzsp { width: 100%; display: flex; justify-content: space-between; } .kzsp>button { border: none; height: 40px; padding: 0 30px; font-size: 16px; background-color: #f95491; border-radius: 10px; color: #fff; transition: 0.3s; cursor: pointer; } .kzsp>button:active { background-color: #e25a00; }</style> <button type="button" id="ckxjj">点我看小姐姐视频</button> <div id="xjjsp"> <video id="player" src="https://www.cunshao.com/666666/api/web.php" controls="" alt="小姐姐视频"></video> <div class="kzsp"> <button id="switch">连续: 开</button> <button id="next">下一个</button> </div> <button type="button" id="gbxjj">关闭视频</button> </div> <script> var player = document.getElementById('player'); var bind = function (element, event, callback) { return element.addEventListener(event, callback); }; var sp = 0; $(document).ready(function () { $('#ckxjj').click(() => { $('#ckxjj').hide(); $('#xjjsp').show(); if (sp == 0) { randomm(); sp = null } player.onerror = () => { randomm() } player.play(); }); $('#gbxjj').click(() => { $('#ckxjj').show(); $('#xjjsp').hide(); player.pause(); }) }); var get = function (id) { return document.getElementById(id); }; var auto = true; // 生成播放视频 function randomm() { player.src = 'http://v.nrzj.vip/video.php'; player.play(); }; bind(get('next'), 'click', randomm); bind(get('switch'), 'click', function () { auto = !auto; this.innerText = '连续:' + (auto ? '开' : '关'); }); bind(player, 'ended', function () { if (auto) randomm(); }); player.pause(); </script> </div> </section><section id="xiaojiejie"> <div class="xiaojiejie"><style>#player { margin: 1px auto; max-width: 100%; border-radius: 10px; display: block; } #xjjsp { display: none; } #ckxjj,#gbxjj { width: 100%; height: 40px; border: none; background-color: #f95491; color: #fff; margin-top: 1px; border-radius: 5px; font-size: 18px; cursor: pointer; transition: 0.2s; } #ckxjj:hover,#gbxjj:hover { background-color: #eeb4bf; } .kzsp { width: 100%; display: flex; justify-content: space-between; } .kzsp>button { border: none; height: 40px; padding: 0 30px; font-size: 16px; background-color: #f95491; border-radius: 10px; color: #fff; transition: 0.3s; cursor: pointer; } .kzsp>button:active { background-color: #e25a00; }</style> <button type="button" id="ckxjj">点我看小姐姐视频</button> <div id="xjjsp"> <video id="player" src="https://www.cunshao.com/666666/api/web.php" controls="" alt="小姐姐视频"></video> <div class="kzsp"> <button id="switch">连续: 开</button> <button id="next">下一个</button> </div> <button type="button" id="gbxjj">关闭视频</button> </div> <script> var player = document.getElementById('player'); var bind = function (element, event, callback) { return element.addEventListener(event, callback); }; var sp = 0; $(document).ready(function () { $('#ckxjj').click(() => { $('#ckxjj').hide(); $('#xjjsp').show(); if (sp == 0) { randomm(); sp = null } player.onerror = () => { randomm() } player.play(); }); $('#gbxjj').click(() => { $('#ckxjj').show(); $('#xjjsp').hide(); player.pause(); }) }); var get = function (id) { return document.getElementById(id); }; var auto = true; // 生成播放视频 function randomm() { player.src = 'http://v.nrzj.vip/video.php'; player.play(); }; bind(get('next'), 'click', randomm); bind(get('switch'), 'click', function () { auto = !auto; this.innerText = '连续:' + (auto ? '开' : '关'); }); bind(player, 'ended', function () { if (auto) randomm(); }); player.pause(); </script> </div> </section>
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容