Advertisement
HimikoWerckmeister

Untitled

Jun 21st, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. var main = function() {
  2. $('.article').click(function() {
  3. $('.article').removeClass('current');
  4. $('.description').hide();
  5.  
  6. $(this).addClass('current');
  7. $(this).children('.description').show();
  8. });
  9.  
  10. $(document).keypress(function(event) {
  11. if(event.which === 111) {
  12. $('.description').hide();
  13.  
  14. $('.current').children('.description').show();
  15. }
  16.  
  17. else if(event.which === 110) {
  18. var currentArticle = $('.current');
  19. var nextArticle = currentArticle.next();
  20.  
  21. currentArticle.removeClass('current');
  22. nextArticle.addClass('current');
  23. }
  24. });
  25. }
  26.  
  27. $(document).ready(main);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement