Save
Saving
  • F fernandol97

    ive also tried the following code :

    const colors = ["#fff", "#000", "#f0f", "#0ff", "#00f", "#ff0", "#0f0"];
    
    window.onload = () => {
      const colorToSet = colors[Math.floor(Math.random() * colors.length)];
      document.querySelector("body").style.backgroundColor = colorToSet;
    };
    

    But all that happens is a bunch of code goes to the top of the page. Pretty new to adding touching the custom css/html. ![alt text](Screenshot 2020-05-28 at 18.29.30.png image url)

    posted in General Discussion read more
  • F fernandol97

    Also trying to achieve this. Quick question about when adding the code in lay options>custom css & html. which box do you enter the code into? do you add it into the custom css box?

    posted in General Discussion read more
  • F fernandol97

    should i be placing the code under lay options > custom CSS & HTML > Custom HTML at bottom? Any advice would be so appreciated!

    posted in General Discussion read more
  • F fernandol97

    I have found the following code on the forum form a couple years ago. however it does not seem to work. Can anyone tell me what i am doing wrong? here is a link to the site: http://mungoadam-smith.co.uk/category/work/

        var colors = ["#551066", '#7b4289', '#a09d24', '#3f3e19', '#3a6b39', '#98c197', '#ab97c1']
        Frontend.GlobalEvents.on("newpageshown", function(){
            var ix = getRandomInt(0, colors.length);
            var color = colors[ix];
            jQuery('body').css('background-color', color);
        });
        
        // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random
        // Returns a random integer between min (included) and max (excluded)
        // Using Math.round() will give you a non-uniform distribution!
        function getRandomInt(min, max) {
            min = Math.ceil(min);
            max = Math.floor(max);
            return Math.floor(Math.random() * (max - min)) + min;
        }
    </script

    posted in General Discussion read more
  • F fernandol97

    @joshsender Ah yeah, I figured it. Pressing clear on the gridder for background colour sets it to transparent! Thanks so much!

    posted in General Discussion read more
  • F fernandol97

    @joshsender said in Animated gradient background glithed since recent updates:

    .slug-info #grid {
    background-color: transparent;
    }

    Thanks Josh,
    so where in the code would I include what you supplied me with? sorry, im new to this side of things. need to get to grips with css

    posted in General Discussion read more