Can't move past "The n shortcut 2"


#1

Interactive Website: The n shortcut 2

I've looked all topics on with this problem, and still can't find solution. Please help :slight_smile:


var main = function() {
    $('.article').click(function() {
    $('.article').removeClass('current');
    $('.description').hide();  
    $(this).addClass('current');
    $(this).children('.description').show();
});
$(document).keypress(function(event) {
    if(event.which === 111) {
        $('.current').children('.description').toggle();
    }
    else if(event.which === 110) {
        var currentArticle = $('.current');
        var nextArticle = currentArticle.next();

        currentArticle.removeClass('current');
        nextArticle.addClass('current');
    }
});
$(document).ready(main);


#2

HI you didn't close the man function


#3

i noticed that soon as i copied here. i fixed that and still doesen't work


#4

Does your code look like that ?

var main = function() {
    $('.article').click(function() {
    $('.article').removeClass('current');
    $('.description').hide();  
    $(this).addClass('current');
    $(this).children('.description').show();
});
$(document).keypress(function(event) {
    if(event.which === 111) {
        $('.current').children('.description').toggle();
    }
    else if(event.which === 110) {
        var currentArticle = $('.current');
        var nextArticle = currentArticle.next();

        currentArticle.removeClass('current');
        nextArticle.addClass('current');
    }
});
} #add this one for closing the main function
$(document).ready(main);

#5

now i does. closed it on the wrong place. thanks a lot :smiley:


#6

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.