I saw a written test question for a senior front-end interview at Renren before.
requires handwritten code. One of the questions is to make a picture display
Similar to the small thumbnail at the bottom of the Baidu picture. Display bar
Then ask for a mouse wheel to make it larger and smaller
I really don’t know how to do this, I looked for information on the Internet
I found that it can be done Capture the onmousewheel event
and then determine whether to roll forward or backward based on the positive or negative value of event.wheelDelta
I just wrote a small example and captured the keyboard keys by the way, which is not very beautiful. There is no line break
Because it is made with textNode and the html code cannot be added
Speaking of which, can this method be used to prevent xss injection?