Получить линейно-градиентный цвет CSS с помощью js - PullRequest
0 голосов
/ 21 июня 2020

Всем привет,

У меня проблема с кодом js.
Действительно, у меня есть переменная, которая позволяет мне получать цвета.
Мне удалось интегрировать его в CSS, чтобы изменить цвет простых свойств, таких как: цвет текста или фона
Но похоже, что это невозможно сделать с помощью свойства « linear-gradient » или даже полос прокрутки .

Не могли бы вы мне помочь? Вот код, который я использую

   $(function() {
  
   // On lance la fonction sur tout le forum
   $.each($('.bodyline'), function( index, value ) {
     
      // Get the color of the group & put it in a variable
      var color_gp = $(this).find('.firstword > span').css('color');
     
      //var domm = document.getElementsByClassName('section-name');
      //domm.style.color = color_gp;
     
      // Condition based on the existence of the content of the variable color_gp
      if (typeof(color_gp) != "undefined") {
        
        // The colour of the group is placed on the texts.
        $(this).find('.seventh-prof-doss-title b, .seventh-prof-bottom-left b, .poster-rango i, .tango n, .seventh-prof-bottom b, .seventh-prof-bio-right h1').css('color', color_gp);
        
        // We place the color of the group on the backgrounds.
        $(this).find('.seventh-prof-doss-2 span.gen, .background-gradiant, div.bouton-indic a').css('background', color_gp);
        
        // We place the color of the group on the background of the scrollbars.
        $(this).find('.profile-corpus-left::-webkit-scrollbar-thumb').css('backgroundColor', color_gp);
        
        // We set the color of the group on the backgrounds in linear-gradient.
        //var dom = document.querySelector("div.profil-pseudo strong b");
    //dom.style.background = '-webkit-linear-gradient(to bottom right, ' + color_gp + ', #ffffff)';
        
        // $('div.profil-pseudo strong b').css({
    //  'background' : '-webkit-linear-gradient(to bottom right, '+color_gp+', #ffffff)',
    //  'background' : '-moz-linear-gradient(to bottom right, '+color_gp+', #ffffff)',
    //  'background' : '-o-linear-gradient(to bottom right, '+color_gp+', #ffffff)',
        //  'background' : '-ms-linear-gradient(to bottom right, '+color_gp+', #ffffff)',
    //  'background' : 'linear-gradient(to bottom right, '+color_gp+', #ffffff)'
    //});
        
        // Place the group color on the borders
        $(this).find('.postfloater').css('outlineColor', color_gp);
      }
   });  
});

Надеюсь, один из вас сможет мне помочь.
Заранее спасибо
Добрый день / вечер

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...