DivMan Posted February 12, 2016 Report Share Posted February 12, 2016 Это нормальный код?https://jsfiddle.net/192xsgqg/1/ 1 Quote Link to comment Share on other sites More sharing options...
0 by chris Posted February 12, 2016 Report Share Posted February 12, 2016 Это нормальный код? Все от твоих предпочтений. Если ты готов дописывать яваскрипт код добавляя новый таб с постом в штмл разметку, то годится. Но врятле кто-то еще захочет заморачиваться, и пойдет искать плагин, который не надо ковырять. Не самый продвинутый код, но миссию свою исполняет.https://jsfiddle.net/192xsgqg/2/ 1 Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted February 15, 2016 Author Report Share Posted February 15, 2016 Я не понимаю, этот код: (function(index) {})Функция не определена и в её начале открывается скобка,так же нигде не учат. Quote Link to comment Share on other sites More sharing options...
0 Igor Schnaider Posted February 15, 2016 Report Share Posted February 15, 2016 Я не понимаю, этот код: (function(index) {})Функция не определена и в её начале открывается скобка,так же нигде не учат. Так это функциональное выражение. Конкретно этот пример смысла не имеет. Обычно такие функции, которые сразу вызываются, создают для того, чтобы создать область видимости для переменных. (function(item) { /* ... */})(); Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted February 15, 2016 Author Report Share Posted February 15, 2016 Почему выскакивает ошибка Uncaught TypeError: Cannot read property 'getAttribute' of undefinedhttps://jsfiddle.net/njz236ms/ Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted February 15, 2016 Author Report Share Posted February 15, 2016 (edited) Почему не читает свойство стиль? https://jsfiddle.net/7tpuu95a/1/ Edited February 15, 2016 by DivMan Quote Link to comment Share on other sites More sharing options...
0 li4e Posted February 15, 2016 Report Share Posted February 15, 2016 Увеличивается i, а проверяется afor(var a = 0; a < tab.length; i++){ tab[a].addEventListener("click", function(){ if(content.children[i].style.display='none'){ content.children[i].style.display='block'; } }) } } Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted February 15, 2016 Author Report Share Posted February 15, 2016 Увеличивается i, а проверяется afor(var a = 0; a < tab.length; i++){ tab[a].addEventListener("click", function(){ if(content.children[i].style.display='none'){ content.children[i].style.display='block'; } }) } }Я это заметил Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted February 15, 2016 Author Report Share Posted February 15, 2016 (edited) Почему не работает? https://jsfiddle.net/7tpuu95a/2/ Edited February 15, 2016 by DivMan Quote Link to comment Share on other sites More sharing options...
0 Q4Dizzy Posted February 15, 2016 Report Share Posted February 15, 2016 А зачем для табов скрипты то использовать? можно же обойтись и радио кнопками + стили.. Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted February 15, 2016 Author Report Share Posted February 15, 2016 А зачем для табов скрипты то использовать? можно же обойтись и радио кнопками + стили.. Если делать без JS, то при добавлении таба, придётся изменять CSS Quote Link to comment Share on other sites More sharing options...
0 by chris Posted February 15, 2016 Report Share Posted February 15, 2016 Увеличивается i, а проверяется a Чтобы браузер крашнулся) Почему не работает? Что показывает консоль лог в переменной i в функции-обработчике метода addEventListener? Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted February 15, 2016 Author Report Share Posted February 15, 2016 Cannot read property 'style' of undefined Quote Link to comment Share on other sites More sharing options...
0 by chris Posted February 15, 2016 Report Share Posted February 15, 2016 (edited) https://jsfiddle.net/sashadev/7tpuu95a/4/-поправил линк Edited February 15, 2016 by by chris Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted June 29, 2016 Author Report Share Posted June 29, 2016 (edited) Почему с помощью jquery не работает? http://plnkr.co/edit/RIkL8PIg7hZZYyWbgFwQ?p=preview Edited June 29, 2016 by DivMan Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted June 29, 2016 Author Report Share Posted June 29, 2016 Почему вкладки не закрываются? http://plnkr.co/edit/Hzt9LPdVa9cT8YCcfu1E?p=preview Quote Link to comment Share on other sites More sharing options...
0 andrey7287 Posted June 29, 2016 Report Share Posted June 29, 2016 $(this).siblings('.accordion_inner').slideToggle(); 1 Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted June 30, 2016 Author Report Share Posted June 30, 2016 Почему не переключается слайдер? http://plnkr.co/edit/O8SrY2F3BvqFtkkhj4mx?p=preview Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted July 20, 2016 Author Report Share Posted July 20, 2016 Почему, функция срабатывает, если кликнуть на подпункт, а не на сам пункт? onclick же присвоен для li http://plnkr.co/edit/94hUCsl33qeQ5fYsR3mO?p=preview и почему то в песочнице не работает Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted July 27, 2016 Author Report Share Posted July 27, 2016 Почему автоматическое закрытие происходит только 1 раз? http://plnkr.co/edit/b5LbiFyk3QtwFBvf03zm?p=preview Quote Link to comment Share on other sites More sharing options...
0 Igor Schnaider Posted July 28, 2016 Report Share Posted July 28, 2016 Намудрил опять что-то :-)http://plnkr.co/edit/ZsJZ6bpjJW0fdohEkmIi?p=preview 1 Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted September 14, 2016 Author Report Share Posted September 14, 2016 Как можно исправить, что бы не ругалась консоль при клике на вложенное меню? http://plnkr.co/edit/Vp0yRLM4CpJEe0gzDPtr?p=preview Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted October 31, 2016 Author Report Share Posted October 31, 2016 Помогите убрать повторение кода. Вот есть код https://jsfiddle.net/9bdaxygb/ Я хочу сделать функцию, которая будет при клики на таб, находить такой же класс у контента и отображать его, а остальное скрыть https://jsfiddle.net/pgbmbx54/ Quote Link to comment Share on other sites More sharing options...
0 Q4Dizzy Posted October 31, 2016 Report Share Posted October 31, 2016 (edited) 6 часов назад, DivMan сказал: Помогите убрать повторение кода. Вот есть код https://jsfiddle.net/9bdaxygb/3/ А тебе исключительно на чистом javascript нужно или jQuery пойдёт? Лично, как по мне - зря только время тратишь, используя исключительно чистый js. Кода во много раз больше, да и вряд ли можно найти сайты без jQuery. Edited October 31, 2016 by Q4Dizzy 1 Quote Link to comment Share on other sites More sharing options...
0 DivMan Posted November 1, 2016 Author Report Share Posted November 1, 2016 Вот у меня тоже была мысль найти совпадение, но не как не доходило, как это сделать, спасибо. Quote Link to comment Share on other sites More sharing options...
Question
DivMan
Это нормальный код?
https://jsfiddle.net/192xsgqg/1/
Link to comment
Share on other sites
24 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.