Home > Web Front-end > JS Tutorial > body text

WordPress JQuery handles sofa avatar_jquery

WBOY
Release: 2016-05-16 18:51:15
Original
1012 people have browsed it

I think this is unfair to Sofa classmates. Yesterday, I was reading the article "Displaying Message Content by Mouse Hover" written by classmate yinheli (it is recommended to read it, it is a good article), and I thought why not copy the avatar of the sofa and put it in a conspicuous position, as shown in the screenshot below.
shafa-screenshot
The first step is to load JQuery on your website, and then add a

where you need to place the sofa avatar. Just leave the content empty:

Copy code The code is as follows:



Then what you need to do is to use js to copy the avatar of the sofa, and fill the copied content into the
set above:
Copy code The code is as follows:

$(document).ready(function() {
$(".commentlist .avatar:last img").clone() .appendTo("#shafa");
});

That’s it. Note that the
avatar
above is assumed to be the style that contains the avatar image in your theme template. Name; then
:last
This is set for reverse order message boards like mine, because the classmates on the sofa are at the end of the message list; for sequential message boards, it is changed to
:first
.
Also, don’t forget to define the CSS style. In addition, using the same method, you can copy specified content, such as the message content of the sofa, names, etc., as long as they correspond to their style names.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template