![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaScript
爱健身_程序猿
这个作者很懒,什么都没留下…
展开
-
文字跑马灯
上下滚动,当前内容文字超过屏幕宽度时,会把当前文字向左移动,看完后,再向下滚动到下一条文字。直接上代码:import React, { useImperativeHandle, useRef, useState, useEffect } from "react";import { useMount } from "ahooks";import styles from './style.module.scss'import classNames from 'classnames/bind'原创 2021-11-03 10:54:19 · 187 阅读 · 0 评论 -
日期选择方法总结 原生js
日期选择方法总结做项目的时候,经常碰到需要根据不同时间段来查询结果的需求,总结了一下当前用到的各个时间段,起始时间和结束时间方法,话不多说,直接上代码:一.获取对应时区的时间getTimeZoneE8(i, timeInt) { if (typeof i !== 'number') return; let d = new Date(timeInt); let len = d.getTime(); let offset = d.getTimezoneOffset原创 2020-10-23 10:21:55 · 447 阅读 · 0 评论 -
typeof 和 instanceof 区别
JavaScript中 typeof 和 instanceof 区别这属于js基础知识,正因为太基础,所以很容易被忽略,导致项目中随处可以见的滥用。一、typeoftypeof 其实就是判断参数是什么类型的实例,就一个参数,用例:typeof a。返回值:"number"、"string"、"boolean"、"object"、"function" 、"undefined"。typeof 12; // numbertypeof 'gym'; // stringtypeof !!’0.原创 2020-09-17 12:11:24 · 156 阅读 · 0 评论 -
jQuery获取Select选择的Text和 Value(转)
jQuery获取Select选择的Text和Value:语法解释:1. $("#select_id").change(function(){//code...}); //为Select添加事件,当选择其中一项时触发2. var checkText=$("#select_id").find("option:selected").text(); //获取Select选择的Text转载 2017-10-12 12:16:13 · 229 阅读 · 0 评论 -
动态给option设置selected后,select下拉框显示不正确,selected=“selected”的option
如上图,设置了selected的option对应值为ef,但是下拉框值是cccccc。//错误代码,$("#selectId option").removeAttr("select");$("#selectId option[value='01']").attr("selected",true);//正确代码$("#selectId option").porp('selected',转载 2017-11-30 15:22:55 · 7101 阅读 · 1 评论 -
浏览器拦截新窗口打开的问题
移动端打开新窗口:Chrome浏览器可以正常打开,iPhone自带Safari浏览器被拦截。在网上找了资料,还是没有得到解决。最终经过自己尝试,新窗口不再被拦截了,解决方式如下:1.ajax中的async:true,改为:async:false。2.然后直接用window.open(URL,"_blank")打开即可。虽然达到了效果,可是道不出个所以然。如果有大佬看到,麻烦告知,感原创 2017-12-02 14:47:06 · 2225 阅读 · 0 评论