When we are an independent foreign trade station, a video may need to pop up and play it on the homepage or other introduction pages, and the background image can be replaced at any time. Some templates will write these codes well. If WordPress’s page builder does not have this function and the purchased template does not have this function, then we have to create a layout and add a background image ourselves to click on the pop-up layer to play the Youtube video code.
The following is the complete front-end code for this piece. There are some minor shortcomings, and a group will explain them:Add CSS styles:
The effect of adding a code background picture on the PC side is as follows:On the PC side, click the background image play button and a layer effect will pop up:
The upper pop-up layer will be at the top of the page, covering other elements, and the position of scrolling up and down on the page remains unchanged. The layer can be closed in the upper right corner, and there is an adaptive mobile terminal. The mobile phone effect is similar. The shortcoming is the mobile terminal style. There is no adaptation. Instead, the size of the background image will change according to different screen widths. Those who understand CSS can modify it themselves. If you are perfectly adaptive, you can send me code to replace it.