随笔分类 -  JavaScript

摘要:HTML: <div class="swiper-container mn-swiper"> <div class="swiper-wrapper"> <div class="swiper-slide">Slide 1</div> <div class="swiper-slide">Slide 2< 阅读全文
posted @ 2021-03-25 17:18 YH丶浩 阅读(191) 评论(0) 推荐(0)
摘要://调用cssget()function cssget() { var style = (function() { var style = document.createElement('style'); document.head.appendChild(style); return style; 阅读全文
posted @ 2021-03-04 09:54 YH丶浩 阅读(242) 评论(0) 推荐(0)
摘要:function getRandomIntInclusive(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min + 1)) + min; //含最 阅读全文
posted @ 2021-02-24 19:08 YH丶浩 阅读(822) 评论(0) 推荐(0)
摘要:防止IE下 下拉加载 多条数据 // 先初始一个变量 var b=0 function scroll(){ //给div绑定一个scroll事件 $('.main').bind('scroll',function(){ var nDivHight = $(".main").height(); nSc 阅读全文
posted @ 2021-01-11 11:40 YH丶浩 阅读(133) 评论(0) 推荐(0)
摘要:function randomID() { return Number(Math.random().toString().substr(2,0) + Date.now()).toString(36); } console.log(randomID()); 阅读全文
posted @ 2021-01-06 19:51 YH丶浩 阅读(1672) 评论(0) 推荐(0)
摘要:1,先获取到浏览器里面的key值 var Game_Data = JSON.parse(localStorage.getItem('loc')) // 之前存储 2,判断这个值存不存在 if (Game_Data == null) { //不存在就建立一个新的数组(第一次进入浏览器肯定是不存在) v 阅读全文
posted @ 2020-12-23 16:27 YH丶浩 阅读(1807) 评论(0) 推荐(0)
摘要:// 返回顶部 //btnTop返回顶部的按钮 // mescroll 内容版块 $(".btnTop").click(function() { $('.mescroll').animate({ scrollTop: 0 }, 1000); return false; }); 阅读全文
posted @ 2020-12-11 15:32 YH丶浩 阅读(77) 评论(0) 推荐(0)
摘要:第一部分:HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link 阅读全文
posted @ 2020-12-11 15:27 YH丶浩 阅读(382) 评论(0) 推荐(0)
摘要:function timestampToTime(timestamp) { var date = new Date(timestamp * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000 var Y = date.getFullYear() + '-'; var M = 阅读全文
posted @ 2020-11-18 11:02 YH丶浩 阅读(687) 评论(0) 推荐(0)
摘要://随机数 var num = Math.ceil(Math.random() * 3) console.log(num); //随机数组 var a = ['1','2','3','4','5']; console.log(a[parseInt(Math.random() * a.length)] 阅读全文
posted @ 2020-11-17 17:23 YH丶浩 阅读(509) 评论(0) 推荐(0)
摘要:<!doctype html> <html lang="'en"> <head> <meta charset="UTF-8"> <title>Tab切换-自动</title> <script src="js/jquery.js"></script> </head> <style> .info-flo 阅读全文
posted @ 2020-11-17 15:43 YH丶浩 阅读(185) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2020-11-11 15:44 YH丶浩 阅读(991) 评论(0) 推荐(0)
摘要:<html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, 阅读全文
posted @ 2020-11-02 12:02 YH丶浩 阅读(122) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2020-10-10 10:20 YH丶浩 阅读(201) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2020-10-10 10:17 YH丶浩 阅读(426) 评论(0) 推荐(0)
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>时钟</title 阅读全文
posted @ 2020-10-10 10:14 YH丶浩 阅读(198) 评论(0) 推荐(0)
摘要:function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象 var r = window.location.search.substr(1).mat 阅读全文
posted @ 2020-09-25 09:52 YH丶浩 阅读(632) 评论(0) 推荐(0)
摘要:Date.prototype.Format = function(fmt) { // author: meizz var o = { "M+": this.getMonth() + 1, // 月份 "d+": this.getDate(), // 日 "h+": this.getHours(), 阅读全文
posted @ 2020-09-25 09:45 YH丶浩 阅读(226) 评论(0) 推荐(0)
摘要:function DateTime(Tid) { var now = new Date(); var validDate = "", day = now.getDate(), month = now.getMonth(), year = now.getFullYear(); var nowTime 阅读全文
posted @ 2020-09-25 09:43 YH丶浩 阅读(350) 评论(0) 推荐(0)
摘要:1 var page = 0; 2 var lock = true; 3 $(window).scroll(function() { 4 //获取#gg这个div到顶部的距离 5 var mTop = $('#gg')[0].offsetTop; 6 //获取窗口的高度 7 var sTop = $ 阅读全文
posted @ 2020-08-17 17:08 YH丶浩 阅读(203) 评论(0) 推荐(0)