Pretty much as the question states.
I can only place html/scripts in limited places (don’t have access to the direct html or source files) so am adding in a short script to add ratings.
It’s meant to display 3 chillis and depending on the rating they will all be red or some red some white. It works perfectly fine on desktop versions but for mobile it’s showing all icons as red and is not picking up the chilli-white css. Anyone have any ideas why?
var spicyRating3 = "<span class='chilli-red'>🌶 🌶 🌶</span>";
var spicyRating2 = "<span class='chilli-red'>🌶 🌶</span><span class='chilli-white'>🌶</span>";
var spicyRating1 = "<span class='chilli-red'>🌶</span><span class='chilli-white'>🌶 🌶</span>";
$(".rating-3").append(spicyRating3);
$(".rating-2").append(spicyRating2);
$(".rating-1").append(spicyRating1);
body {
background-color: lightblue;
}
.agenda .chilli-red {
color: #ff0000;
}
.agenda .chilli-white {
color: #fff;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.slim.min.js"></script>
<p class="rating-3"></p>
<p class="rating-2"></p>
<p class="rating-1"></p>
Mobile (should only show one chilli but all are red/not working)
2
Answers
Updated css to the below and it works as required now - thanks Phil for the link
Or use SVG images instead of emoji