Article From:https://segmentfault.com/q/1010000012140637
Answer 0:

Yoursif (!($(this)[href=pre_url])) {}I don’t understand what I mean. It’s not like this.
$('#a').remove();It is directly deletedid=aYour usage is wrong
$("a[href!='']").each(function() {})Superfluous$("a[href!='']").on('mouseenter')Add events to all selected elements

$(document).ready(function() {
    $("a[href!='']").on('mouseenter', function(event) {
        var bool = false;
        var pre_url = $(this).attr("href");
        $("link").each(function() {
            if (($(this).attr("href")==pre_url)) {//It is not added to judge whether or not it exists.Bool = true}});If (! Bool) {$("head").Append ('< link rel= "prerender" href= "" + pre_url + ">");}});$("a["Href! = '' ")").On ('mouseleave', function (event) {{)Var pre_url = $(this).Attr ("href"); / / as long as the mouse is removed, delete.Except for all judgment$('link[href= '' + pre_url + '' ').Remove ();});});

Similar Posts:

Link of this Article: How to dynamic prerender pages?

Leave a Reply

Your email address will not be published. Required fields are marked *