Skip to content

Instantly share code, notes, and snippets.

@elvisgiv
Created May 23, 2016 11:45
Show Gist options
  • Save elvisgiv/a869b915d6e856b41684e6a4f1feb852 to your computer and use it in GitHub Desktop.
Save elvisgiv/a869b915d6e856b41684e6a4f1feb852 to your computer and use it in GitHub Desktop.

Задача: сделать появляющееся что-то с помощью javascript

%ul#list
  %li
    %a.togglelink{:href => "#"} America
    .toggle{:style => "display: block;"}
      %p America - USA - the States
  %li
    %a.togglelink{:href => "#"} Brazil
    .toggle{:style => "display: block;"}
      %p Brazil - Federative Republic of Brazil


:javascript
  $(document).ready(function () {
    $('.toggle').hide();
    $('a.togglelink').on('click', function (e) {
        e.preventDefault();
        var elem = $(this).next('.toggle')
        $('.toggle').not(elem).hide('slow');
        elem.toggle('slow');
    })
  });

Это пример, просто примени его у себя и поймешь, что тебе делать)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment