How to make SVG in ::before pseudo-class clickable?2019 Community Moderator ElectionSetting CSS pseudo-class rules from JavaScriptHow to convert a PNG image to a SVG?CSS Pseudo-classes with inline stylesCSS3 :unchecked pseudo-classHow to convert a SVG to a PNG with Image Magick?make an html svg object also a clickable linkHow to change color of SVG image using CSS (jQuery SVG image replacement)?Is there a way to use SVG as content in a pseudo element :before or :afterAfter updating firefox 55 Inline images (img) is not rendering in HTML CANVAS through SVGHow to change color of SVGs on pseudo class element on hover?
How are passwords stolen from companies if they only store hashes?
ERC721: How to get the owned tokens of an address
Fastest way to pop N items from a large dict
Employee lack of ownership
If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how?
Have the tides ever turned twice on any open problem?
Counting models satisfying a boolean formula
Knife as defense against stray dogs
Why one should not leave fingerprints on bulbs and plugs?
Is "upgrade" the right word to use in this context?
Equivalents to the present tense
What is a ^ b and (a & b) << 1?
Adventure Game (text based) in C++
Why does overlay work only on the first tcolorbox?
How difficult is it to simply disable/disengage the MCAS on Boeing 737 Max 8 & 9 Aircraft?
Why do tuner card drivers fail to build after kernel update to 4.4.0-143-generic?
The German vowel “a” changes to the English “i”
Describing a chess game in a novel
Planetary tidal locking causing asymetrical water distribution
Is there a hypothetical scenario that would make Earth uninhabitable for humans, but not for (the majority of) other animals?
Why did it take so long to abandon sail after steamships were demonstrated?
As a new Ubuntu desktop 18.04 LTS user, do I need to use ufw for a firewall or is iptables sufficient?
Recruiter wants very extensive technical details about all of my previous work
Is honey really a supersaturated solution? Does heating to un-crystalize redissolve it or melt it?
How to make SVG in ::before pseudo-class clickable?
2019 Community Moderator ElectionSetting CSS pseudo-class rules from JavaScriptHow to convert a PNG image to a SVG?CSS Pseudo-classes with inline stylesCSS3 :unchecked pseudo-classHow to convert a SVG to a PNG with Image Magick?make an html svg object also a clickable linkHow to change color of SVG image using CSS (jQuery SVG image replacement)?Is there a way to use SVG as content in a pseudo element :before or :afterAfter updating firefox 55 Inline images (img) is not rendering in HTML CANVAS through SVGHow to change color of SVGs on pseudo class element on hover?
I have a breadcrumb that lists the page's hierarchy path. I hid the first anchor tag & changed the anchor tag ::before pseudo-class to an SVG of a small house like so:
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
I got the desire effect but the SVG is not clickable to return to the home page. Any solutions for this? I don't mind whether CSS or JS.
This is the image so it gives you an idea:
Thanks in advance!
svg breadcrumbs pseudo-class
add a comment |
I have a breadcrumb that lists the page's hierarchy path. I hid the first anchor tag & changed the anchor tag ::before pseudo-class to an SVG of a small house like so:
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
I got the desire effect but the SVG is not clickable to return to the home page. Any solutions for this? I don't mind whether CSS or JS.
This is the image so it gives you an idea:
Thanks in advance!
svg breadcrumbs pseudo-class
add a comment |
I have a breadcrumb that lists the page's hierarchy path. I hid the first anchor tag & changed the anchor tag ::before pseudo-class to an SVG of a small house like so:
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
I got the desire effect but the SVG is not clickable to return to the home page. Any solutions for this? I don't mind whether CSS or JS.
This is the image so it gives you an idea:
Thanks in advance!
svg breadcrumbs pseudo-class
I have a breadcrumb that lists the page's hierarchy path. I hid the first anchor tag & changed the anchor tag ::before pseudo-class to an SVG of a small house like so:
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
I got the desire effect but the SVG is not clickable to return to the home page. Any solutions for this? I don't mind whether CSS or JS.
This is the image so it gives you an idea:
Thanks in advance!
svg breadcrumbs pseudo-class
svg breadcrumbs pseudo-class
asked Mar 6 at 20:32
Manuel AbascalManuel Abascal
57210
57210
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
I have found a way to make the SVG on a ::before pseudo-class clickable through jQuery like so:
SCSS Code:
This is the styling to hide the anchor tag & add an SVG to the anchor tag before pseudo-class.
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
cursor: pointer;
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
cursor: pointer;
JavaScript Code:
//Store the href attribute(the link was already pointing to the home page) of the anchor tag in a variable
var breadcrumbHomeLink = $('.breadcrumb__list--item:first-child a').attr('href');
//Store the SVG with ::before pseudo-class in variable
var breadcrumbSVG = $('.breadcrumb__list--item:first-child').before();
//Make Breadcrumb SVG clickable & redirect to home page
breadcrumbSVG.on('click', function()
location.href = breadcrumbHomeLink;
);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031706%2fhow-to-make-svg-in-before-pseudo-class-clickable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I have found a way to make the SVG on a ::before pseudo-class clickable through jQuery like so:
SCSS Code:
This is the styling to hide the anchor tag & add an SVG to the anchor tag before pseudo-class.
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
cursor: pointer;
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
cursor: pointer;
JavaScript Code:
//Store the href attribute(the link was already pointing to the home page) of the anchor tag in a variable
var breadcrumbHomeLink = $('.breadcrumb__list--item:first-child a').attr('href');
//Store the SVG with ::before pseudo-class in variable
var breadcrumbSVG = $('.breadcrumb__list--item:first-child').before();
//Make Breadcrumb SVG clickable & redirect to home page
breadcrumbSVG.on('click', function()
location.href = breadcrumbHomeLink;
);
add a comment |
I have found a way to make the SVG on a ::before pseudo-class clickable through jQuery like so:
SCSS Code:
This is the styling to hide the anchor tag & add an SVG to the anchor tag before pseudo-class.
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
cursor: pointer;
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
cursor: pointer;
JavaScript Code:
//Store the href attribute(the link was already pointing to the home page) of the anchor tag in a variable
var breadcrumbHomeLink = $('.breadcrumb__list--item:first-child a').attr('href');
//Store the SVG with ::before pseudo-class in variable
var breadcrumbSVG = $('.breadcrumb__list--item:first-child').before();
//Make Breadcrumb SVG clickable & redirect to home page
breadcrumbSVG.on('click', function()
location.href = breadcrumbHomeLink;
);
add a comment |
I have found a way to make the SVG on a ::before pseudo-class clickable through jQuery like so:
SCSS Code:
This is the styling to hide the anchor tag & add an SVG to the anchor tag before pseudo-class.
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
cursor: pointer;
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
cursor: pointer;
JavaScript Code:
//Store the href attribute(the link was already pointing to the home page) of the anchor tag in a variable
var breadcrumbHomeLink = $('.breadcrumb__list--item:first-child a').attr('href');
//Store the SVG with ::before pseudo-class in variable
var breadcrumbSVG = $('.breadcrumb__list--item:first-child').before();
//Make Breadcrumb SVG clickable & redirect to home page
breadcrumbSVG.on('click', function()
location.href = breadcrumbHomeLink;
);
I have found a way to make the SVG on a ::before pseudo-class clickable through jQuery like so:
SCSS Code:
This is the styling to hide the anchor tag & add an SVG to the anchor tag before pseudo-class.
li:first-child a
display: none;
li:first-child::before
color: transparent;
content: '';
cursor: pointer;
display: block;
width: rem(16px);
height: rem(16px);
position: relative;
top: rem(2px);
margin: 0;
background-image: url("../images/breadcrumb-image.svg");
background-repeat: no-repeat;
background-size: cover;
background-position: center;
&:hover
color: transparent;
cursor: pointer;
JavaScript Code:
//Store the href attribute(the link was already pointing to the home page) of the anchor tag in a variable
var breadcrumbHomeLink = $('.breadcrumb__list--item:first-child a').attr('href');
//Store the SVG with ::before pseudo-class in variable
var breadcrumbSVG = $('.breadcrumb__list--item:first-child').before();
//Make Breadcrumb SVG clickable & redirect to home page
breadcrumbSVG.on('click', function()
location.href = breadcrumbHomeLink;
);
edited Mar 9 at 22:36
answered Mar 9 at 22:21
Manuel AbascalManuel Abascal
57210
57210
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031706%2fhow-to-make-svg-in-before-pseudo-class-clickable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown