2017-05-25 38 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>