首页 > 编程学习 > 浪漫表白编程丨程序员的520表白代码 _ 程序员专属情人节表白网站

❤ 精彩专栏推荐👇🏻👇🏻👇🏻
💂 作者主页: 【进入主页—🚀获取更多源码】
🎓 web前端期末大作业: 【📚HTML5网页期末作业 (1000套) 】
🧡 程序员有趣的告白方式:【💌HTML七夕情人节表白网页制作 (125套) 】
七夕来袭!是时候展现专属于程序员的浪漫了!你打算怎么给心爱的人表达爱意?鲜花礼物?代码表白?还是创意DIY?或者…无论那种形式,快来秀我们一脸吧!


📂文章目录

  • 二、📚网站介绍
  • 三、🔗网站效果
    • ▶️1.视频演示
    • 🧩 2.图片演示
  • 四、💒 网站代码
    • 🧱HTML结构代码
    • 🏠CSS样式代码
  • 五、🎁更多源码


二、📚网站介绍

📒网站文件方面:html网页结构文件、css网页样式文件、js网页特效文件、images网页图片文件;

📙网页编辑方面:可使用任意HTML编辑软件(如:Dreamweaver、HBuilder、Vscode 、Sublime 、Webstorm、Text 、Notepad++ 等任意html编辑软件进行运行及修改编辑等操作)。
其中:
(1)📜html文件包含:其中index.html是首页、其他html为二级页面;
(2)📑 css文件包含:css全部页面样式,3D动态效果,雪花飘落等等
(3)📄 js文件包含:页面炫酷效果实现


三、🔗网站效果

▶️1.视频演示

88-七夕告白(520气球)

🧩 2.图片演示

在这里插入图片描述


四、💒 网站代码

🧱HTML结构代码

<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <!--<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0'/>-->
    <script type="text/javascript">
        var phoneWidth = parseInt(window.screen.width);
        var phoneScale = phoneWidth / 640;
        var ua = navigator.userAgent;
        if (/Android (\d+\.\d+)/.test(ua)) {
            var version = parseFloat(RegExp.$1);
            // andriod 2.3
            if (version > 2.3) {
                document.write('<meta name="viewport" content="width=640, minimum-scale = ' + phoneScale + ', maximum-scale = ' + phoneScale + ', target-densitydpi=device-dpi">');
                // andriod 2.3以上
            } else {
                document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
            }
            // 其他系统
        } else {
            document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
        }
    </script>
    <title>告白气球</title>
    <script src="js/html5shiv.min.js" type="text/javascript"></script>
    <link href="css/animate.min.css" rel="stylesheet" type="text/css">
    <link href="css/css.css" rel="stylesheet" type="text/css">
    <link href="css/swiper.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" id="pageloader-css" href="css/pageloader.css" type="text/css" media="all" />
    <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
  <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
    <!-- Link Swiper's CSS -->
    <script src="js/loading.js" type="text/javascript"></script>
    <style>
    </style>
</head>

<body>
    <audio loop src="images/01.mp3" id="audio" autoplay preload="auto"></audio>
    <div class="music"><img class="music-img ro" src="images/music.png">
        <div class="music-p"><img src="images/music.gif"></div>
    </div>
    <!--加载 -->
    <div id="bonfire-pageloader">
        <div class="bonfire-pageloader-icon">
            <img src="images/loadgif.gif" />
        </div>
    </div>
    <!--加载 -->


    <div class="zb" style="position:absolute;top:0;z-index:999;font-size:2rem;display:none">
        <p> 坐标: (beta=<span id="beta" class="value">null</span>, gamma=<span id="gamma" class="value">null</span>, alpha=<span id="alpha" class="value">null</span>, 滚动背景值=
            <span id="lefts">null</span>,屏幕宽=<span id="bjk">null</span>,移动屏幕比=<span id="pmb">null</span>,开关=<span id="open">null</span>,</p>
    </div>
    <div class="swiper-container SwiperBig">
        <div class="swiper-wrapper">

            <!--p1-->
            <div class="swiper-slide p1 swiper-no-swiping">
                <div class="p1-box">
                    <div class="p1-text">戳破气球,看看会发生什么?</div>
                    <div class="p1_ball"><img src="images/ball.png" /></div>
                    <div class="ball_boomdiv"></div>
                    <div class="p1_ballx"><img src="images/ball-x.png" /></div>
                    <div class="p1-cloud"><img src="images/cloud.png" /></div>
                    <!--p1-1-->
                    <div class="ball01 "><img src="images/orange-ball.png" /></div>
                    <div class="ball02"><img src="images/red-ball.png" /></div>
                    <div class="ball03"><img src="images/pink-ball.png" /></div>
                    <div class="ball04"><img src="images/yellow-ball.png" /></div>
                </div>
            </div>
            <!--p2-->
            <div class="swiper-slide">
                <div class="p2-box">
                    <div class="p2-centerBox">
                        <div class="p2-centerImg"></div>
                    </div>
                    <div class="p2-text01"></div>
                    <div class="p2-text02"></div>
                    <div class="p2-cloudLeft"></div>
                    <div class="p2-cloudHeart"></div>
                    <div class="p2-cloudRight"></div>
                </div>
            </div>
            <!--p3-->
            <div class="swiper-slide">
                <div class="p3-box">
                    <div class="bj">
                        <div class="bj01 on"></div>
                        <div class="bj02 hide"></div>
                    </div>
                    <div class="p3-text">
                        <p>彩虹走廊 —“穿越七彩的时光来遇见你”</p>
                        <P>汇金星力城 1F 中庭</P>
                    </div>
                    <div class="p3-num">您已穿越:<span id="cy-num">1</span>光年</div>
                    <div class="p3-phone">
                        <img src="images/phoneGIF.gif" />
                        <p>左右翻转试一试</p>
                    </div>
                </div>
            </div>
            <!--p4-->
            <div class="swiper-slide">
                <div class="p4-box">
                    <div class="p4-yiy01 on"></div>
                    <div class="p4-yiy02 hide"></div>
                    <div class="p4-text"><img src="images/P4-text.png" /></div>
                    <div class="p4-text02"><img src="images/P4-text02.png" /></div>
                </div>
            </div>
            <!--p5-->
            <div class="swiper-slide swiper-no-swiping">
                <div class="p5-box">
                    <div class="p5-text">你是第<span>534</span>位 “热气球”升空助力者</div>
                    <div class="p5-Time hide">倒计时<span>15</span></div>
                    <div class="p5-heart"></div>
                    <div class="p5-jt"></div>
                    <div class="p5-ball"></div>
                    <div class="p5-ball02"></div>
                    <div class="p5-light"></div>
                    <div class="p5-light2"></div>
                    <div class="p5-light3"></div>
                    <div class="p5-light4"></div>
                    <div class="p5-btn"><img src="images/p5-btn.png" /></div>
                </div>
            </div>
            <!--p7-->
            <div class="swiper-slide">
                <div class="p7-box">
                    <div class="swiper-container p7-swiper" style="margin-top:42%;">
                        <div class="swiper-wrapper">
                            <div class="swiper-slide"><img src="images/p7-1.jpg" /></div>
                            <div class="swiper-slide"><img src="images/p7-2.jpg" /></div>
                            <div class="swiper-slide"><img src="images/p7-3.jpg" /></div>
                            <div class="swiper-slide"><img src="images/p7-4.jpg" /></div>
                        </div>
                    </div>

                </div>
            </div>

            <!--p6-->
            <div class="swiper-slide swiper-no-swiping">
                <div class="p6-box">
                    <div class="p6-centerBox">
                        <div class="p6-centerImg"></div>
                    </div>
                    <div class="p6-text01"></div>
                    <div class="p6-text02"></div>
                    <div class="p6-img1"><img src="images/P6-m1.png" /></div>
                    <div class="p6-img2"><img src="images/P6-m2.png" /></div>
                    <div class="p6-end"></div>
                </div>
            </div>
        </div>
    </div>
    <script src="js/swiper.min.js" type="text/javascript"></script>
    <script src="js/jquery.js" type="text/javascript"></script>
    <script src="js/main.js" type="text/javascript"></script>
    <script src="js/pageloader.js" type="text/javascript"></script>

    <script>
        $(".p1_ball").bind("click", function() {
            $(this).hide();
            $(".ball_boomdiv").show().addClass("ball_boom");
            $(".p1_ballx,.p1-text").hide();
            setTimeout(function() {
                $(".ball01").addClass("ball_ani").css({
                    "display": "block",
                    "opacity": "1"
                })
            }, 500);
            setTimeout(function() {
                $(".ball02").addClass("ball_ani").css({
                    "display": "block",
                    "opacity": "1"
                })
            }, 1000);
            setTimeout(function() {
                $(".ball03").addClass("ball_ani").css({
                    "display": "block",
                    "opacity": "1"
                })
            }, 1300);
            setTimeout(function() {
                $(".ball04").addClass("ball_ani").css({
                    "display": "block",
                    "opacity": "1"
                })
            }, 1600);
            setTimeout(function() {
                swiper.slideTo(1, 1500, true);
                $(".ball01,.ball02,.ball03,.ball04").hide();
            }, 4300)
        })

        function DJ_time() {
            var djs = $(".p5-Time span").text();
            $(".p5-Time").show();
            $(".p5-Time span").text($(".p5-Time span").text() - 1);
            if ($(".p5-Time span").text() <= 0) {
                $(".p5-Time span").text(0);
            }
        }
        $(".p5-btn").one("click", function() {
            $(".p5-heart").addClass("hear_ball-ani");
            $(".p5-jt").show();
            var aj = setInterval("DJ_time()", 1000)
            $(".p5-heart").css("background", "url(images/heartBal.png) -3% 0 no-repeat")
            setTimeout(function() {
                $(".p5-heart").css("background", "url(images/heartBal.png) 32% 0 no-repeat")
            }, 5000)
            setTimeout(function() {
                $(".p5-heart").css("background", "url(images/heartBal.png) 66.5% 0 no-repeat")
            }, 9000)
            setTimeout(function() {
                $(".p5-heart").css("background", "url(images/heartBal.png) 101% 0 no-repeat");
            }, 15000)
            setTimeout(function() {
                $(".p5-ball,.p5-ball02").hide();
                $(".p5-heart").removeClass("hear_ball-ani");
                $(".p5-light,.p5-light2,.p5-light3,.p5-light4").hide();
                alert("你是第534位 “热气球”升空助力者");
                swiper.slideTo(5, 1000, true);
            }, 16000)
            setTimeout(function() {
                $(".p5-ball").addClass("ballUp");
            }, 1000)
            setTimeout(function() {
                $(".p5-ball02").addClass("ballUp");
            }, 1500)
            setTimeout(function() {
                $(".p5-light").addClass("animated flash light-over").css("opacity", "1");
                $(".p5-light2").addClass("animated flash light-over").css("opacity", "1");
                $(".p5-light3").addClass("animated flash light-over").css("opacity", "1");
                $(".p5-light4").addClass("animated flash light-over").css("opacity", "1");
            }, 2500)
        })



        /*跑道*/
        setInterval(function() {
            if ($(".bj01").hasClass("on")) {
                $(".bj01").addClass("hide").removeClass("on").siblings(".bj02").removeClass("hide").addClass("on")
            } else {
                $(".bj02").addClass("hide").removeClass("on").siblings(".bj01").removeClass("hide").addClass("on")
            }
        }, 300)
        var swiper = new Swiper('.p7-swiper', {
            autoplay: 3000,
            autoplayDisableOnInteraction: false
        });

        var swiper = new Swiper('.SwiperBig', {
            mousewheelControl: true,
            direction: 'vertical',
            pagination: '.swiper-pagination',
            onSlideChangeEnd: function(swiper) {
                if (swiper.activeIndex == 0) {
                    $(".p1").removeClass("swiper-no-swiping");
                    $(".p1_ball").show();
                    $(".p1_ballx,.p1-text").show();
                }
                /*p1*/
                if (swiper.activeIndex == 1) {
                    setTimeout(
                        function() {
                            $(".p2-centerBox").addClass("animated fadeInUp").css("opacity", "1")
                        }, 200);
                    setTimeout(
                        function() {
                            $(".p2-centerImg").addClass("animated swing").css("opacity", "1")
                        }, 1100);
                    setTimeout(
                        function() {
                            $(".p2-text01").addClass("animated fadeInUp").css("opacity", "1")
                        }, 1900);
                    setTimeout(
                        function() {
                            $(".p2-text02").addClass("animated fadeInUp").css("opacity", "1")
                        }, 2300);
                    setTimeout(
                        function() {
                            $(".p2-cloudLeft").addClass("animated fadeOutLeft").css("opacity", "1")
                        }, 2800);
                    setTimeout(
                        function() {
                            $(".p2-cloudRight").addClass("animated fadeOutRight").css("opacity", "1")
                        }, 2800);
                    setTimeout(
                        function() {
                            $(".p2-cloudHeart").addClass("animated pulse").css("opacity", "1")
                        }, 3500);
                }
                /*p1-end*/
                else if (swiper.activeIndex == 2) {
                    $("#cy-num").text(0);
                } else if (swiper.activeIndex == 3) {
                    /*摇一摇*/
                    setInterval(function() {
                        if ($(".p4-yiy01").hasClass("on")) {
                            $(".p4-yiy01").addClass("hide").removeClass("on").siblings(".p4-yiy02").removeClass("hide").addClass("on")
                        } else {
                            $(".p4-yiy02").addClass("hide").removeClass("on").siblings(".p4-yiy01").removeClass("hide").addClass("on")
                        }
                    }, 300)

                    //运动事件监听
                    if (window.DeviceMotionEvent) {
                        window.addEventListener('devicemotion', deviceMotionHandler, false);
                    }
                    //获取加速度信息
                    //通过监听上一步获取到的x, y, z 值在一定时间范围内的变化率,进行设备是否有进行晃动的判断。
                    //而为了防止正常移动的误判,需要给该变化率设置一个合适的临界值。
                    var SHAKE_THRESHOLD = 10000;
                    var last_update = 0;
                    var x, y, z, last_x = 0,
                        last_y = 0,
                        last_z = 0;
                    var isOne = 0;

                    function deviceMotionHandler(eventData) {
                        var acceleration = eventData.accelerationIncludingGravity;
                        var curTime = new Date().getTime();
                        if ((curTime - last_update) > 10) {
                            var diffTime = curTime - last_update;
                            last_update = curTime;
                            x = acceleration.x;
                            y = acceleration.y;
                            z = acceleration.z;
                            var speed = Math.abs(x + y + z - last_x - last_y - last_z) / diffTime * 10000;
                            if (speed > SHAKE_THRESHOLD) {
                                $(".p4-yiy01,.p4-yiy02").hide(); // Do somethingp4-box
                                setTimeout(function() {
                                    $(".p4-box").css("background", "url(images/P4-bg.jpg) 33.4% 0 no-repeat")
                                }, 200);
                                setTimeout(function() {
                                    $(".p4-box").css("background", "url(images/P4-bg.jpg) 66.7% 0 no-repeat")
                                }, 400);
                                setTimeout(function() {
                                    $(".p4-box").css("background", "url(images/P4-bg.jpg) 100% 0 no-repeat")
                                }, 600);
                                setTimeout(function() {
                                    $(".p4-text").addClass("animated fadeIn").css("opacity", "1")
                                }, 1100)
                                setTimeout(function() {
                                    $(".p4-text02").addClass("animated fadeInUp").css("opacity", "1")
                                }, 1600)
                                isOne = 1;
                                if (isOne == 1) {
                                    window.removeEventListener('devicemotion', deviceMotionHandler, false);
                                }
                            }
                            last_x = x;
                            last_y = y;
                            last_z = z;
                        }
                    }
                }
                /*P6-begin*/
                else if (swiper.activeIndex == 6) {
                    setTimeout(
                        function() {
                            $(".p6-centerBox").addClass("animated fadeInUp").css("opacity", "1")
                        }, 200);
                    setTimeout(
                        function() {
                            $(".p6-centerImg").addClass("animated swing").css("opacity", "1")
                        }, 1100);
                    setTimeout(
                        function() {
                            $(".p6-text01").addClass("animated fadeInUp").css("opacity", "1")
                        }, 1900);
                    setTimeout(
                        function() {
                            $(".p6-text02").addClass("animated fadeInUp").css("opacity", "1")
                        }, 2300);
                    setTimeout(
                        function() {
                            $(".p6-img1").addClass("animated fadeInUp").css("opacity", "1")
                        }, 2500);
                    setTimeout(
                        function() {
                            $(".p6-img1 img").addClass("animated fadeInRight").css("opacity", "1")
                        }, 2600);
                    setTimeout(
                        function() {
                            $(".p6-img2").addClass("animated fadeInUp").css("opacity", "1")
                        }, 2700);
                    setTimeout(
                        function() {
                            $(".p6-img2 img").addClass("animated fadeInLeft").css("opacity", "1")
                        }, 2800);
                    setTimeout(
                        function() {
                            $(".p6-img3").addClass("animated fadeInUp").css("opacity", "1")
                        }, 2900);
                    setTimeout(
                        function() {
                            $(".p6-img3 img").addClass("animated fadeInRight").css("opacity", "1")
                        }, 3000);
                    setTimeout(
                        function() {
                            $(".p6-end").show().addClass("end-anidiv")
                        }, 3800);
                    setTimeout(
                        function() {
                            $(".p6-end").hide()
                        }, 4800);
                }
            }
            /*P6-end*/

        });
    </script>
    <script>
        //音乐类
        $(function() {
            $("#audio_btn").click(function() {
                var music = document.getElementById("music");
                if (music.paused) {
                    music.play();
                    $("#music_btn").attr("src", "play.png");
                } else {
                    music.pause();
                    $("#music_btn").attr("src", "pause.png");
                }
            });
            []
            a = $("span [class='swiper-pagination-bullet swiper-pagination-bullet-active']").index();
            //alert(a);

        })


        var audio = document.getElementById("audio");
        audio.load();
        audio.play();

        document.addEventListener("WeixinJSBridgeReady", function() {
            audio.play();
        }, false);
        $('.music').click(function() {
            if ($('.music-img').is('.ro')) {
                $('.music-img').removeClass('ro')
                $('.music-p').css('display', 'none')
                audio.pause();
            } else {
                $('.music-img').addClass('ro')
                $('.music-p').css('display', 'block')
                audio.play();
            }
        })
    </script>




    <!-- BEGIN PLACE LOADING ICON IN THE MIDDLE OF THE PAGE -->
    <script>
        jQuery(window).resize(function() {
            resizenow();
        });

        function resizenow() {
            var browserwidth = jQuery(window).width();
            var browserheight = jQuery(window).height();
            jQuery('.bonfire-pageloader-icon').css('right', ((browserwidth - jQuery(".bonfire-pageloader-icon").width()) / 2)).css('top', ((browserheight - jQuery(".bonfire-pageloader-icon").height()) / 2));
        };
        resizenow();
    </script>
</body>

</html>




🏠CSS样式代码


.clearfix:after {
    clear: both;
    content: "Matrix";
    display: block;
    font-size: 0;
    height: 0;
    visibility: hidden;
}

*html .clearfix {
    height: 1%;
}

*+html .clearfix {
    height: 1%;
}

.clearfix {
    display: inline-block;
}

.clearfix {
    display: block;
}

.clearfix {
    zoom: 1
}

html>body .clearfix {
    overflow: hidden;
}

.clear {
    clear: both;
    height: 0px;
    line-height: 0px;
    font-size: 0px;
    overflow: hidden;
}

.floatbox {
    overflow: hidden;
}

* html .floatbox {
    display: table;
    width: 100%;
}

#ie_clearing {
    display: none;
}

.opacity {
    -moz-opacity: 0.65;
    filter: alpha(opacity=65);
    opacity: 0.65;
}

.max640 {
    max-width: 640px;
    margin: auto;
    overflow: hidden
}

.none {
    display: none
}

.swiper-container {
    max-width: 640px;
    height: 100%;
}

/*swiper*/

.container {
    display: block;
    width: 96%;
    padding-left: 2%;
    padding-right: 2%;
    background: #fff;
}

.container h3 {
    line-height: 30px;
    font-weight: bold;
    font-size: 1.6rem;
    height: 30px;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    color: #333
}





五、🎁更多源码

1.如果我的博客对你有帮助 请 “👍点赞” “✍️评论” “💙收藏” 一键三连哦!

2.💗【👇🏻👇🏻👇🏻🉑关注我| 获取更多源码】 带您学习各种前端插件、3D炫酷效果、图片展示、文字效果、以及整站模板 、大学生毕业HTML模板 、等!

📣以上内容技术相关问题💌欢迎一起交流学习👇🏻👇🏻👇🏻

Copyright © 2010-2022 mfbz.cn 版权所有 |关于我们| 联系方式|豫ICP备15888888号