2012-07-14 2 views
0

스택에 비슷한 스레드가 있지만 나에게 적합하지 않습니다.jQuery는 클릭 후 새 배경을 희미하게합니다.

나는 클릭 한 후에 변경하고 싶은 신체 배경을 가지고있다.

$('#start').click(function(){ 
    $(this).fadeOut('slow'); 
    $('#help').fadeOut('slow'); 
    $('#exit').fadeOut('slow'); 

    setTimeout(function(){ 
      $('body').css('background-image','url(media/note.jpg)'); 
    },500); 
}); 

그래서 새 배경을 fadeIn으로 지정합니다. 나는 내가 생각할 수있는 모든 방법으로 운율없이 추가하려고 시도했다.

이렇게 할 방법이 있습니까?

+0

어떨까요? http://stackoverflow.com/questions/977090/fading-in-a-background-image – bingjie2680

답변

1

이 같은 지연 클래스를 추가 할 jQuery를 UI 라이브러리를 사용할 수 있습니다

​.note{ 
    background-image:url('media/note.jpg'); 
    /*more styling if you like */ 
}​ 

는 jQuery를 사용하려면 다음과 같은

$(document).ready(function() { 
    $("#start").click(function() { 
     $(this).fadeOut('slow'); 
     $('#help').fadeOut('slow'); 
     $('#exit').fadeOut('slow'); 
     $('body').addClass("note", 1000); 
    }); 
}); 

클래스 "노트"를 볼 것 UI 라이브러리에서 html HEAD 태그에 다음 스크립트를 추가해야합니다.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> 
<script src="http://ui.jquery.com/latest/ui/effects.core.js"></script> 

C 예를 들어 jsFiddle을 꺼내십시오 : CLICK!

관련 문제