jQuery文件已连接但jQuery无法正常工作

时间:2017-07-09 01:49:39

标签: jquery html css



std::unique_ptr<Thread> Thread::Create(CreationParameters params,
                                   std::function<void()> start_routine) {
auto start_data = new ThreadStartData({std::move(start_routine)});
HANDLE handle =
  CreateThread(NULL, params.stack_size, ThreadStartRoutine, start_data,
               params.create_suspended ? CREATE_SUSPENDED : 0, NULL);
if (handle == INVALID_HANDLE_VALUE) {

void Thread::Exit(int exit_code) { ExitThread(exit_code); }
&#13;
$(document).ready(function () {
   $('.lead')hide().fadeIn('slow');
    
   
});
&#13;
.lead {
        font-size: 10rem;
        font-weight: bold;
        color: #3fddff;
        text-shadow: 5px 5px 5px #000;
    
        position: fixed;
        bottom: 0;
        right: 0;
        margin-right: 5rem;
        margin-bottom: 6rem;
        border-bottom: 3px solid #fff;        
    }
    
    .webdev {
        font-size: 3rem;
        font-weight: bold;
        color: #000;
        text-shadow: 3px 3px 3px #aaa;
         
        position: fixed;
        bottom: 0;
        right: 0;
        margin-right: 25rem;
        margin-bottom: 2rem;        
    }
    
    .lead {
    display: none;
}
&#13;
&#13;
&#13;

您好,

我无法让我的fadeIn()在我的页面上工作。一旦我的页面加载,我试图让我的名字淡入,但由于某种原因,这种情况不会发生。我知道该文件已正确链接,因为我使用console.log测试了它,但fadeIn()根本不起作用。我对jQuery很陌生,但我认为这是更容易实现的功能之一。我忽略了什么吗?

感谢您的帮助。

最佳, 埃德温

3 个答案:

答案 0 :(得分:3)

您使用的是slim版本的jQuery,其中不包含许多功能,包括动画。

如果您想要完整的功能集,请将.slim更改为.min中的https://code.jquery.com/jquery-3.2.1.slim.js

<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>

中也有拼写错误
$('.lead').hide().fadeIn('slow');
       //^^ missing dot

答案 1 :(得分:1)

1检查在您执行任何操作之前,请导航到您的jQuery文件并检查它是否确实存在。

2加载此http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js?ver=1.4.2'>

答案 2 :(得分:1)

没有超薄版本可以正常使用

<script src="https://code.jquery.com/jquery-3.2.1.min.js"
        integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
        crossorigin="anonymous">

你可以删除hide(),因为你已经使用CSS隐藏了它。

$('.lead').fadeIn('slow');

仔细检查jQuery slim是否具有fadeIn()功能,在开发控制台中你可能会看到这个错误(或者至少是我所看到的):

  

jquery-3.2.1.slim.js:3860 jQuery.Deferred exception:$(...)。fadeIn is   不是函数TypeError:$(...)。fadeIn不是函数       ......