Statistics
| Branch: | Tag: | Revision:

root / htdocs / site_media / js / intro-hover.js @ 8b8cd850

History | View | Annotate | Download (1.1 kB)

1
$(document).ready(function(){
2

    
3
    if ($(".logohover").length == 0) { return };
4

    
5
    var cont = $(".logocontent");
6

    
7
    var inactive = $("img.img1");
8
    var active = $("img.img2");
9

    
10
    active.hide();
11
    
12
    reposition = function() {
13
        var winheight = $(window).height();
14
        var winwidth = $(window).width();
15

    
16
        var imgheight = 590;
17
        var imgwidth = 524;
18

    
19
        var top = (winheight / 2) - (imgheight / 2);
20
        if (top < 0) { top = 0; };
21

    
22
        
23
        var left = (winwidth / 2) - (imgwidth / 2);
24
        if (left < 0) { left = 0; };
25

    
26
        $(".logohover img").css({top:top, left:left});
27
    }
28

    
29
    reposition();
30
    $(window).resize(reposition);
31

    
32
    var time = 500;
33
    var hovering = false;
34
    var capture = cont;
35
    capture.mouseenter(function() {
36
        if (hovering) { return };
37
        hovering = true;
38
        inactive.fadeOut(time);
39
        active.fadeIn(time);
40
    })
41
    capture.mouseleave(function() {
42
        if (!hovering) { return };
43
        
44
        hovering = false;
45
        active.fadeOut(time);
46
        inactive.fadeIn(time);
47
    });
48
})