phdphd Posted January 16, 2019 Share Posted January 16, 2019 Hi All, I am trying to apply some fading effect to a Div, for which I want also to set an hex color. This works : $('#myDiv').css('color', 'blue'); $('#myDiv').fadeIn(5000, function() { $(this).delay(3000).fadeOut(3000); }); This doesn't: $('#myDiv').css('color', '#050709'); $('#myDiv').fadeIn(5000, function() { $(this).delay(3000).fadeOut(3000); }); Thanks ! Quote Link to comment https://forums.phpfreaks.com/topic/308184-apply-hex-color-to-div-with-jquery/ Share on other sites More sharing options...
requinix Posted January 16, 2019 Share Posted January 16, 2019 There's no meaningful difference between those two. Are you sure you're seeing the color:blue from your css() and not from something else? Does it still seem to work with red, or green? Quote Link to comment https://forums.phpfreaks.com/topic/308184-apply-hex-color-to-div-with-jquery/#findComment-1563624 Share on other sites More sharing options...
phdphd Posted January 16, 2019 Author Share Posted January 16, 2019 Yes I am sure it comes from css(). And it works with any color by name, like red or FireBrick. Quote Link to comment https://forums.phpfreaks.com/topic/308184-apply-hex-color-to-div-with-jquery/#findComment-1563627 Share on other sites More sharing options...
requinix Posted January 16, 2019 Share Posted January 16, 2019 #050709 is close to black. Could it be working but you aren't noticing? What about something like #FFFF00? Remove the bit causing it to fade out, then inspect the element in your browser. What CSS does it report? Quote Link to comment https://forums.phpfreaks.com/topic/308184-apply-hex-color-to-div-with-jquery/#findComment-1563629 Share on other sites More sharing options...
phdphd Posted January 16, 2019 Author Share Posted January 16, 2019 2 hours ago, requinix said: #050709 is close to black. Could it be working but you aren't noticing? What about something like #FFFF00? Hum, I think I need to go to my ophthalmologist... Quote Link to comment https://forums.phpfreaks.com/topic/308184-apply-hex-color-to-div-with-jquery/#findComment-1563637 Share on other sites More sharing options...
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.