Lenix

go tcp programming

There are two types of network programming: 1) TCP socket programming is the mainstream of network programming. The reason why it is called Tcp socket programming is because the bottom layer is based on the Tcp/ip protocol. For example: QQ chat 2) http programming of b/s structure, when we use the browser to access the […]

go tcp programming Read More »

html video video leave picture in picture event leavepictureinpicture event

The leavepictureinpicture event is fired when the HTMLVideoElement leaves picture-in-picture mode successfully. This event is not cancelable and does not bubble. Syntax Use the event name in methods like addEventListener() , or set an event handler property. addEventListener ( ‘leavepictureinpicture’ … The post html video video exit picture-in-picture event leavepictureinpicture event first appeared on Lenix

html video video leave picture in picture event leavepictureinpicture event Read More »

html js click on blank space to close custom popup layer

Usually to make a custom drop-down box, the expanded div needs to be closed after clicking any blank area $(document).on(‘click’,function(e){ var _con = $(‘.ztree,.js_ztree’); // Set the target area (check elements that do not need to be closed when clicking) if(!_con.is(e.target)&&_con.has(e.target).length === 0){ $(‘.ztree’).hide() } }) … The post html js closing custom popup layer

html js click on blank space to close custom popup layer Read More »

video picture-in-picture (small window)

video picture-in-picture (small window) < video id = “video_paly” controls src = “https://v-cdn.zjol.com.cn/280443.mp4” poster = “https://ossweb-img.qq.com/images/lol/web201310/skin/big91012.jpg” >您的浏览器不支持video 标签。 < / video > < button onClick = { ( ) => { var video : any = document . getElementById ( “video_paly” … The post video Picture-in-Picture (Small Window) first appeared on Lenix Blog . This

video picture-in-picture (small window) Read More »

JavaScript, jQuery’s css method is invalid

I ran into a problem today. Trying to add css attributes to a node through jquery to make it achieve the expected style performance. But it doesn’t work. But in another way. Invalid spelling: //这种写法不生效。 $dom.find(“p.text-p”).css(“-webkit-line-clamp”,3) ; //或$dom.find(“p.text-p”).css({“-webkit-line-clamp”:3}) ; Effective spelling: //此处这个3,可以是个变量。 $dom.find(“p.text-p”).attr(“style”, “-webkit-line-clamp:” + 3); Note that in this case, the css() method does

JavaScript, jQuery’s css method is invalid Read More »

How to replace strings in js

The method of string replacement in js: 1. Use regular expression, the syntax is [str.replace(“string to be replaced”, “new string”)]; 2. Use conventional replacement method, the syntax is [ str.replace(/string to be replaced/g, “new string”)]. Related graphic recommendation: js tutorial The method of string replacement in js: Two methods: regular & regular str.replace(“string to be

How to replace strings in js Read More »

[JS] fetch() usage replaces ajax

Article directory fetch basic use Response object 1. Synchronization properties 2. Judgment request 3. Operation header 4. Read the content 5. Create a copy 6, the bottom interface custom HTTP request cancel the fetch request fetch basic use The Fetch API provides an interface for obtaining resources (including cross-domain requests), which is used to replace

[JS] fetch() usage replaces ajax Read More »

js implements the copy function

js implements the copy function 1. Specific scene The front-end sometimes needs to implement the function of clicking a button to copy. At this time, the user cannot manually select the content and right-click to copy. 2. Implementation method 1. document.execCommand (1) concrete realization When copying, first select the text, then call document.execCommand(‘copy’), the selected

js implements the copy function Read More »

urlencode encoding in js

urlencode encoding encodeURIComponent in js (the specific content of the encoding) Decode decodeURIComponent (the specific content of the decoded code) Rationale: Encode the components of the URL individually, not for encoding the entire URL … The post urlencode encoding in js first appeared on Lenix Blog . This article is reprinted from https://blog.p2hp.com/archives/9069 This site

urlencode encoding in js Read More »

this points to the problem, the onclick event is bound to the label this points to the problem

<input type=”button” value=”modify” οnclick=”changeContent()”> The function changeContent written in onclick on the element is equivalent to calling the function directly. The this used in the function points to the global object window, instead of pointing to the element Then to get the object of the node where the onclick is located, we need to pass

this points to the problem, the onclick event is bound to the label this points to the problem Read More »