douweng7083 2019-07-19 14:42
浏览 76
已采纳

为什么jquery加载来自functions.php的第二次刷新

I am converting an html template to WordPress. I use wp_enqueue_script() from functions.php page. But the .js files loads after second refresh of the page. I have progress bar and top (link to top of the page) on home page which are not working. Please help

I tried wp_deregister_script('jquery'); but it also not working

function loadjs(){
    wp_deregister_script('jquery');

    wp_register_script('juery', get_template_directory_uri() . '/assets/js/jquery-3.2.1.min.js');
    wp_enqueue_script('juery');
wp_register_script('custom', get_template_directory_uri() . '/assets/js/custom.js');
    wp_enqueue_script('custom');
}

add_action('wp_enqueue_scripts', 'loadjs');

progress bar work after second refresh and top function not working

  • 写回答

1条回答 默认 最新

  • doujing4555 2019-07-22 09:21
    关注

    Thanks for replying everyone, I just figure out the solution. This was due to jquery and solved with a plugin called 'jquery updater'.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决