Задать вопрос
Ответы пользователя по тегу JavaScript
  • Как сделать такой эффект ховера?

    AntonEssential
    @AntonEssential Автор вопроса
    В общем сделал сам, не идаельно но меня утсраивает. Может кому понадобиться

    .main-menu
        &__link 
           position relative
           overflow hidden
           +before('')
              display block
              width 100%
              height 4px
              background-color $yellow
              position absolute
              top 50%
              transform translateX(-116%)
              z-index 1
          
    .is-active
       +before()
          transform translateX(116%)
          transition ease-in-out .6s

    (function() {
    
        var link = $('.main-menu__link');
    
        if(!link.hasClass('is-active')) {
            link.mouseover(function(event) {
                $(this).addClass('is-active')
            })
            link.mouseleave(function(event) {
                var self = $(this);
                setTimeout(function(){
                    self.removeClass('is-active')
                },300);
            });
        }
    
    })();
    Ответ написан
    Комментировать
  • Как пересчитать высоту объекта window?

    AntonEssential
    @AntonEssential Автор вопроса
    Ответ нашелся.
    function msgHeightSize(){
      if ($(window).height() <= '830'){
        $('.msgs-scroll').css( 
          'height', (parseInt($(window).height())-150) + "px"
        );
      } 
    }
    $(window).load(function(){
      msgHeightSize()
    });
    $(window).resize(function(){
      msgHeightSize()
    });
    Ответ написан
    Комментировать
  • Как передать нужный елемент?

    AntonEssential
    @AntonEssential Автор вопроса
    Нашел решение.
    $(function() {
        var $document = $(document);
        var $r = $('input[type="range"]');
        var output = document.querySelectorAll('output')[0];
      
        // set initial output value
        // output.innerHTML = $r[0].value;
        
        // update output value
        $document.on('input', 'input[type="range"]', function(e) {
          output.innerHTML = e.currentTarget.value;
        });
        
        // Initialize
        $r.rangeslider({
          polyfill: false
        }); 
      });
    Ответ написан
    Комментировать
  • Как отслеживать клик?

    AntonEssential
    @AntonEssential Автор вопроса
    Всем спасибо
    Ответ написан
    Комментировать