user1070034 user1070034 - 2 months ago 5x
CSS Question

SVG css3 transition on fill not working when there is external link

I have a problem similar to this one : here.

Only difference is that the page I want to link the SVG to is an external page meaning :

Currently in my code, changing the link to an internal page makes the css3 transition work but having it link to an external (http://) overrides the css3 transition I made.

If anyone has a workaround this issue or has dealt with this before. Please help!





This is actually something to do with the visited state. The reason the other commenters are saying it works is because they haven't been to your pages before. Once they have it will no longer work. I've tried adding visited states in the CSS and it makes no difference.

The easiest solution I've found is to just add a random query string to the url so the page is effectively not visited eg:

<a href="http:/<?php echo rand(0, 99999) ?>">My Link</a>

Most sites will ignore a query they don't recognise so that should be ok. Or better would be to remove it with JS on click.

$('body').on('click', 'a', function(e) {
    var url = $(this).prop('href');
    window.location.href = url.split("?")[0];