我有以下我曾嘗試到目前爲止fiddle
http://jsfiddle.net/BLPgX/我要褪色的,而不是添加類和刪除class.Also如果用戶將鏈接複製像http://www.myweb.com/test/ques.jsp#Faq1 DIV如何fade
DIV?如何淡出/突出顯示鏈接點擊相應的div jQuery中
感謝&問候
我有以下我曾嘗試到目前爲止fiddle
http://jsfiddle.net/BLPgX/我要褪色的,而不是添加類和刪除class.Also如果用戶將鏈接複製像http://www.myweb.com/test/ques.jsp#Faq1 DIV如何fade
DIV?如何淡出/突出顯示鏈接點擊相應的div jQuery中
感謝&問候
我在下面的方式
$(document).ready(function(){
if(document.location.href.indexOf('#') > -1){
var id = location.hash.replace("#","");
$thisAns = $("#"+id);
$thisAns.addClass("highlightAns");
// Remove that class after 2 seconds
setTimeout(function(){
$thisAns.removeClass("highlightAns");
},2000);
}
else{
console.log("URL does not contains Id");
}
$('.highlight').on('click', function() {
// Get the div that should be higlighted now
var id = $(this).attr('href').replace("#", "");
$thisAns = $('#'+id);
// Add highlightAns class
$thisAns.addClass("highlightAns");
// Remove that class after 2 seconds
setTimeout(function(){
$thisAns.removeClass("highlightAns");
},2000);
});
});
試試這個:
// Add highlightAns class
$thisAns.addClass("highlightAns").fadeIn("slow");
// Remove that class after 2 seconds
setTimeout(function(){
$thisAns.removeClass("highlightAns").fadeOut("slow");
},2000);
淡出你的意思的背景做了? – Albzi
是淡出背景.. –
第二個鏈接不起作用。 –