Add a loading prompt for the article title link

abstract Clicking the link of article title will prompt that it is loading It looks fun, doesn't it. For specific effects, click the title link of my blog post. Now let's teach you how to add this special effect to your theme template. This special effect is also inseparable from jQuery. First

Clicking the link of article title will prompt that it is loading It looks fun, doesn't it. For specific effects, click the title link of my blog post. Now let's teach you how to add this special effect to your theme template.

This special effect is also inseparable from JQuery.

First, open the header.php template file of the theme you are using, and add the following before the tag:

  1. 1. <script type= "text/javascript" src= " http://jqueryjs.googlecode.com/files/jquery-1.2.3.min.js " ></script>

If your theme has been loaded with JQuery, this step is unnecessary.

Then add the following code to the front of the</head>tag

  1. <script type= "text/javascript" >
  2. $(document).ready( function () {
  3. $('h2 a').click( function (){
  4. myloadoriginal = this .text;
  5. $( this ). text ('Loading force... ');
  6. var myload = this ;
  7. setTimeout( function () { $(myload).text(myloadoriginal); }, 2011);
  8. });
  9. });
  10. </script>

"H2 a" is the tag selector for the title of the topic article, which can be modified according to the specific topic template. If it is changed to "a", the special effect can be added to all links. The following number 2011 is the display time of this special effect (milliseconds), which can be modified as appropriate.

How to add HotNews pro version 2.4

HotNews pro version 2.4 has loaded multiple header.php files, so it is more convenient to write directly to the loaded js file. Add the following code directly to the end of the custom.js file:

  1. //Prompt during loading
  2. $(document).ready( function (){
  3. $('h3 a,.tab ul li ul a,.cat_post a').click( function (){
  4. myloadoriginal = this .text;
  5. $( this ). text ('Loading force... ');
  6. var myload = this ;
  7. setTimeout( function () { $(myload).text(myloadoriginal); }, 2011);
  8. });
  9. });

For the above JS code, if there is a bug in Opera browser proposed by children's shoes, it should be replaced by:

  1. //Prompt during loading
  2. $(document).ready(function(){
  3. $('h3 a,.tab ul li ul a,.cat_post a,.r_comments a').click(function(){
  4. $( this ). text ('Loading force... ');
  5. window.location = $( this ).attr('href');
  6. });
  7. });

It is found that adding special effects will affect some multi tag browsers. Open the link in the new tag, and the current tag will jump to the link page at the same time.

Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!

 weinxin
My Wechat
WeChat copied
Copyright Notice
Please indicate the source and link of the original article reprinted on this site. Thank you for your cooperation!
five hundred and ninety-eight million eight hundred and forty-five thousand and six
 
 Robin
five hundred and ninety-eight million eight hundred and forty-five thousand and six
Comments seventy    Visitors fifty    Author sixteen
    •  kael
      kael seven

      The first one to grab the sofa~~Ha ha, finally it's used!

      •  People who can see the wind
        People who can see the wind six

        Why does the page display in Chrome remain unchanged after I add the code to the JS file, but it has changed in 360 browser-
        And how to add the inserted image at the top right of your comment bar~

        •  People who can see the wind
          People who can see the wind six

          Another problem is that if I enable the WP No Category Base plug-in, the category in other places will not be displayed, but there is a category in the address of the current small icon in the column.

          •  remai8
            remai8 one

            I have changed to your topic now, but I can't comment or leave messages. What's the reason? Please give me some advice!!
            This is my website: http://www.remai8.info/

              •  Robin
                Robin

                @ remai8 Probably because your Win host has function limitations
                It's better not to use a junk Win host when playing WP

              •  People who can see the wind
                People who can see the wind six

                Another question is, after enabling the wp share list plug-in, do you need to select to enable "jquery1.4.2 library for plug-in introduction" in the plug-in background

                •  People who can see the wind
                  People who can see the wind six

                  There is still another question. How to realize your "notify me by email when someone replies" method after replying to comments. Maybe I have a lot of questions, hope to get answers~~

                  •  Robin
                    Robin

                    Mapping Test

                    •  Active volcano
                      Active volcano zero

                      Is this topic friendly to SEO? Please tell me, SEO is very important. I don't know whether it has been taken into consideration!

                      •  People who can see the wind
                        People who can see the wind six

                        Can you share the background image of your current web page? Or share more backgrounds suitable for this theme~~hehe

                        •  Mr. Bean
                          Mr. Bean six

                          When you have time to write a tutorial to teach us this function~good! Very powerful!

                          •  Niche media
                            Niche media five

                            It's a dazzling style. I saw a lot of people standing there early, so I'll try it later...

                            •  Broken Words about Life
                              Broken Words about Life five

                              [img] http://www.jszby.com/wp-content/uploads/2010/04/logo002.jpg [/img]

                              •  C.J.Y
                                C.J.Y three

                                Invalid under Opear... Do not go to the link page after loading

                                  •  Robin
                                    Robin

                                    @ C.J.Y It means Opear is abnormal and will disappear completely sooner or later
                                    Find out the reason later

                                  •  JaCall
                                    JaCall four

                                    This function is good! Added!

                                    •  Morninglight Blog
                                      Morninglight Blog five

                                      I really like this feature. I also got it on holiday. It's very nice!

                                      •  ★Extreme★
                                        ★Extreme★ four

                                        JQuery is really powerful!!! Learn again!!!!

                                        •  ordinary people
                                          ordinary people three

                                          Brother Bird, I found a slightly discordant place. According to your method, when you click on the latest articles, popular articles, random articles and other columns, the message "Loading with force..." will also appear, but it seems meaningless to see this here
                                          [img] http://www.ade-bug.com/ade-bug-picture/ade-bug.jpg [/img]

                                          •  ordinary people
                                            ordinary people three

                                            Add a class="nogeili" to the three tags and tags, and then
                                            $(this). text ('Loading under force... ');
                                            Exclusion judgment is added before:
                                            if($(this).attr(“class”).indexOf(“nogeili”)){
                                            $(this). text ('Loading under force... ');
                                            }

                                              •  Robin
                                                Robin

                                                @ ordinary people Very good technology
                                                Actually, it doesn't need to be so troublesome. Just change the tag selector. It has been updated

                                                  •  ordinary people
                                                    ordinary people three

                                                    @ Robin Shame, don't know about JQ, why didn't I think of this.. Brother Bird, do you do front-end development? Cowman!

                                                      •  ordinary people
                                                        ordinary people three

                                                        @ ordinary people Also, my code above is wrong, ha ha.
                                                        Should be:
                                                        if($(this).attr(“class”).indexOf(“nogeili”)==-1){
                                                        $(this). text ('Loading under force... ');
                                                        }
                                                        But it doesn't work anymore.

                                                          •  Robin
                                                            Robin

                                                            @ ordinary people Let me try. It seems a bit troublesome, but many choices are also good

                                                          •  Robin
                                                            Robin

                                                            @ ordinary people Just a bad computer mechanic

                                                      •  appointment
                                                        appointment three

                                                        Brother Bird, why does yours work under Google Chrome, but mine doesn't

                                                        •  Broken Words about Life
                                                          Broken Words about Life five

                                                          It doesn't seem to be very useful. I won't do this for the time being.

                                                          •  wotry
                                                            wotry four

                                                            It's fun, but I don't see the effect after adding it, whether in Google Chrome or Internet Explorer. It is useless to copy and upload the JS file of your website directly. Is it not loaded?

                                                            •  daydreamer
                                                              daydreamer one

                                                              I even succeeded

                                                                •  oldtree
                                                                  oldtree zero

                                                                  @ daydreamer Why can't the background picture of 2.4 be displayed???

                                                                •  Bakhtiyar
                                                                  Bakhtiyar three

                                                                  Brother Bird, I used 2.4 After custom.js is changed, firefox does not display this effect, and other browsers can. Your blog also displays normally in Firefox. Thanks for your guidance.

                                                                    •  Robin
                                                                      Robin

                                                                      @ Bakhtiyar Although I don't know the text of your site, it seems to display normally

                                                                        •  Bakhtiyar
                                                                          Bakhtiyar three

                                                                          @ Robin Brother Bird, you really saw my site, which made me so happy!! HotNews pro 2.4 I have translated it into Uighur, and here is your website link, hey hey... Thank you very much.

                                                                      •  Moxia
                                                                        Moxia one

                                                                        Thank you. The effect is very good~

                                                                        •  Two kilogram Qiqu
                                                                          Two kilogram Qiqu two

                                                                          It's used. It's too handsome. The bird is too big...

                                                                          •  Smartree Smart Tree
                                                                            Smartree Smart Tree two

                                                                            This experience is very good, reducing the blind perception of "waiting to load" by visitors

                                                                            •  xwey
                                                                              xwey one

                                                                              This is good. It is really available after local modification!

                                                                              •  Fruits Basket
                                                                                Fruits Basket two

                                                                                At present, there are 60 messages, including 42 visitors, 15 bloggers, and 3 citations

                                                                                Brother Bird, how can you change this into your own?

                                                                                •  Blueberry green tea
                                                                                  Blueberry green tea four

                                                                                  This function is good. I've learned it~

                                                                                  •  Afternoon and summer
                                                                                    Afternoon and summer zero

                                                                                    Hey hey, you've learned a trick to steal. Use it!

                                                                                    •  Yuannuono
                                                                                      Yuannuono four

                                                                                      I want to ask you how to display something like a bulletin board at the bottom of the page

                                                                                        •  Robin
                                                                                          Robin

                                                                                          @ Yuannuono What I have here is not an announcement, but another form of log
                                                                                          It seems that there is a similar plug-in, 100 poison search "WP toolbar"

                                                                                        •  oceanmen
                                                                                          oceanmen two

                                                                                          Done~ I felt it was very good

                                                                                          •  How to make money on the Internet
                                                                                            How to make money on the Internet one

                                                                                            The blogger's blog is really beautiful

                                                                                            •  Alphas
                                                                                              Alphas one

                                                                                              It is found that adding special effects will affect some multi tag browsers. Open the link in the new tag, and the current tag will jump to the link page at the same time.
                                                                                              This is the case with my Chrome. How can I solve or cancel this function? I use your latest version 2.7

                                                                                             anonymous

                                                                                            Comment

                                                                                            Anonymous netizens
                                                                                             :?:  :razz:  :sad:  :evil:  :!:  :smile:  :oops:  :grin:  :eek:  :shock:  :???:  :cool:  :lol:  :mad:  :twisted:  :roll:  :wink:  :idea:  :arrow:  :neutral:  :cry:  :mrgreen:

                                                                                            Drag the slider to complete validation