2017-05-25 46 views
-1

大家好,晚上好,我如何隐藏使用jQuery

我是jQuery的新手,我遇到了hide()函数的问题。我按照指示做了代码,但我似乎仍然有问题。

谢谢 埃德

$(document).ready(function() { 
 
    'use strict'; 
 
    $("p.class-text").on("mouseover", function() { 
 
     $(this).fadeOut(5000); 
 
    }); 
 
    
 
});
<div class="card"> 
 
    <a href="http://www.castro4designs.com" target="_blank"><img src="img/home.png" height="240" width="356" alt="4Design Home Page"></a> 
 
    <p class="card-text">Castro4design.com was my first official website which was done for my 'Intro to New Media Tech' class. The site consist of basic HTML and CSS. The site was to keep track of all our work throughout our college career.</p> 
 
</div>

+0

您还没有引用jQuery的文件正确。请检查。 – User3250

+0

不清楚你想要做什么。 –

+2

没有'p.class-text' .... – epascarello

回答

3

你已经没有p带班class-textp类是card-text

使用$("p.card-text")代替$("p.class-text")

0

您应该使用相同的类名:例如“card-text”。还将jQuery标签添加到您的代码段中。

$(document).ready(function() { 
 
    'use strict'; 
 
    $("p.card-text").on("mouseover", function() { 
 
     $(this).fadeOut(1000); 
 
    }); 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 

 
<div class="card"> 
 
    <a href="http://www.castro4designs.com" target="_blank"><img src="img/home.png" height="240" width="356" alt="4Design Home Page"></a> 
 
    <p class="card-text">Castro4design.com was my first official website which was done for my 'Intro to New Media Tech' class. The site consist of basic HTML and CSS. The site was to keep track of all our work throughout our college career.</p> 
 
</div>