Change background image on link hover

后端 未结 4 1165
南旧
南旧 2021-01-26 10:53

So I have this problem, which I couldn\'t find, even though I did a thorough websearch.

I am making my portfolio, and the background is a picture of a woman, located in

4条回答
  •  不知归路
    2021-01-26 11:38

    Yes, here's a rough example via JSFiddle http://jsfiddle.net/dGnMX/

    
    
    $("#first").click(function () {
    
        $("body").css("background-image", 'url("http://static.bbc.co.uk/solarsystem/img/ic/640/collections/space_exploration/space_exploration_large.jpg")');
    
    });
    
    
    
    $("#second").click(function () {
    
        $("body").css("background-image", 'url("http://i.telegraph.co.uk/multimedia/archive/02179/Milky-Way_2179177b.jpg")');
    
    });
    
    $("#third").click(function () {
    
        $("body").css("background-image", 'url("http://www.thatsreallypossible.com/wp-content/uploads/2012/12/Space-Colonialisation.jpg")');
    
    });
    

提交回复
热议问题