- Toggle Tab.s Clicking a link opens a tab and closes all the others. You should ideally be able to have multiple tab sections on a page working independently of each other.
- Modals. Clicking a link opens up a modal dialogue window.
- Save Form Data. When someone updates a form field (or clicks a "Save" button, your choice), save their form data to
localStorage. If they refresh the page, reload their saved data into the field. - Toggle Password Visibility. Checking a checkbox reveals the password in an
input[type="password"]field in plain text so users can verify that they typed it correctly. - Make Content the Same Height. If you have a few columns of text, side-by-side but different heights (with a background color or something), set them all to be as tall as the tallest content area.
- Generate a Table of Contents. Automatically generate a table of contents based on the
h2-h6headings on the page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| axios.put(this.apiBaseEndpoint + '/' + id, input) | |
| .then((response) => { | |
| // Success | |
| }) | |
| .catch((error) => { | |
| // Error | |
| if (error.response) { | |
| // The request was made and the server responded with a status code | |
| // that falls out of the range of 2xx | |
| // console.log(error.response.data); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link rel="stylesheet" href="style.css"> | |
| <script src="script.js"></script> | |
| </head> | |
| <body> | |
| <header id="header" class="header"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // Methods | |
| // | |
| /** | |
| * Get an element's distance from the top of the page | |
| * @param {Node} elem The element | |
| * @return {Number} Distance from the top of the page | |
| */ | |
| var getElemDistance = function ( elem ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/ | |
| // Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch | |
| // async function | |
| async function fetchAsync () { | |
| // await response of fetch call | |
| let response = await fetch('https://api.github.com'); | |
| // only proceed once promise is resolved | |
| let data = await response.json(); | |
| // only proceed once second promise is resolved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function() { | |
| /* Define a variável que dá swipe no lightbox */ | |
| var magnificPopup = $.magnificPopup.instance; | |
| /* Carrega a função quando clica no lightbox (senão não pega a classe utilizada) */ | |
| $("a.image-lightbox").click(function(e) { | |
| /* Espera carregar o lightbox */ | |
| setTimeout(function() { | |
| /* Swipe para a esquerda - Próximo */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $slick_slider = $('.slider'); | |
| settings = { | |
| slidesToShow: 2, | |
| slidesToScroll: 2, | |
| infinite: false, | |
| arrows: false | |
| } | |
| $slick_slider.slick(settings); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('a[href*=#]:not([href=#])').click(function() { | |
| if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { | |
| var target = $(this.hash); | |
| target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); | |
| if (target.length) { | |
| $('html,body').animate({ | |
| scrollTop: target.offset().top - 56 | |
| }, 500); | |
| return false; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.callback-form').each(function(){ | |
| // Объявляем переменные (форма и кнопка отправки) | |
| var form = $(this), | |
| btn = form.find('.callback-form__submit'); | |
| // Добавляем каждому проверяемому полю, указание что поле пустое | |
| form.find('.callback-form__input').addClass('empty'); | |
| // Функция проверки полей формы | |
| function checkInput(){ |
NewerOlder