Issues (311)

js/main.js (5 issues)

Labels
Severity
1
/**
2
 * File main.js.
3
 *
4
 * Contains majority of the theme scripts
5
 */
6
( function( $ ) {
7
    
8
    // directory uri
9
    template_directory = directory_name.templateUrl;
0 ignored issues
show
The variable directory_name seems to be never declared. If this is a global, consider adding a /** global: directory_name */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
The variable template_directory seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.template_directory.
Loading history...
10
11
    // portfolio view image handler
12
    $( '#portfolio-wrapper .view-image' ).on('click', function() {
13
14
        $img_src = $(this).next().find('img').attr('src');
0 ignored issues
show
The variable $img_src seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.$img_src.
Loading history...
15
        // clone the title of the portfolio that was clicked on and append it to our container
16
        $title_div = $(this).next().next().clone();
0 ignored issues
show
The variable $title_div seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.$title_div.
Loading history...
17
18
        $img = $('#view-image-container .content-wrapper img');
0 ignored issues
show
The variable $img seems to be never declared. Assigning variables without defining them first makes them global. If this was intended, consider making it explicit like using window.$img.
Loading history...
19
20
        // make the container visible
21
        $('#view-image-container').css('display', 'flex');
22
23
        // append the title 
24
        $('#view-image-container .content-wrapper').append($title_div);
25
        // set image src
26
        $img.attr('src', $img_src);
27
    });
28
29
    // portfolio close view-image
30
    $('#view-image-container .close').on('click', function() {
31
        // remove post-title div first
32
        $(this).next().remove();
33
        // then hide the whole container
34
        $(this).parent().parent().css('display', 'none');
35
    });
36
37
    // all hover effects
38
    $('#header-search-btn').hover( function() {
39
        $(this).attr('src', template_directory + '/assets/images/search-icon-hover.png');
40
    }, function() {
41
        $(this).attr('src', template_directory + '/assets/images/search-icon-normal.png');
42
    });
43
44
    $('#social-facebook').hover( function() {
45
        $(this).attr('src', template_directory + '/assets/images/facebook-hover.png');
46
    }, function() {
47
        $(this).attr('src', template_directory + '/assets/images/facebook.png');
48
    });
49
50
    $('#social-gp').hover( function() {
51
        $(this).attr('src', template_directory + '/assets/images/gp-hover.png');
52
    }, function() {
53
        $(this).attr('src', template_directory + '/assets/images/gp.png');
54
    });
55
56
    $('#social-linkedin').hover( function() {
57
        $(this).attr('src', template_directory + '/assets/images/linkedin-hover.png');
58
    }, function() {
59
        $(this).attr('src', template_directory + '/assets/images/linkedin.png');
60
    });
61
62
    $('#social-pin').hover( function() {
63
        $(this).attr('src', template_directory + '/assets/images/pin-hover.png');
64
    }, function() {
65
        $(this).attr('src', template_directory + '/assets/images/pin.png');
66
    });
67
68
    $('#social-twitter').hover( function() {
69
        $(this).attr('src', template_directory + '/assets/images/twitter-hover.png');
70
    }, function() {
71
        $(this).attr('src', template_directory + '/assets/images/twitter.png');
72
    });
73
74
}) ( jQuery );
75
76