Home › Forums › JavaScript › How to Nullify An Event Listener
- This topic is empty.
-
AuthorPosts
-
May 11, 2014 at 2:30 pm #169829
bmoneruiux
ParticipantHey JavaScript people…
Is there a way to nullify a event listener I can’t find?
Long story short, I’m pretty sure there’s something in a WordPress theme that’s doing something like:
$("#logo").click(function(){ window.location=$(this).find("a").attr("href"); if value is <?php echo home_url( '/' ); ?>; do nothing; if value is not <?php echo home_url( '/' ); ?> prepend <?php echo home_url( '/' ); ?> to that value; });
<div id="logo"> span class="site-name"><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span> <span class="site-description"><?php bloginfo( 'description' ); ?></span> </div>
Is there a way to find out and, if yes, nullify this behavior?
May 12, 2014 at 4:23 am #169854bmoneruiux
ParticipantWow I know I haven’t been here in a while when your face brought back every single newb memory I had to the surface. Good to hear from you again.
Long story short, I’m using WordPress for my personal portfolio site. I’m using a free theme called “Responsive” as a sort of framework. I had an interesting idea to use an animated SVG graphic as an icon just for added flare. So I copied my coding into their existing DIV structure, and followed suit with my CSS and jQuery also. It was soon discovered that SVG fill’s don’t like to obey transitions when in an anchor tag with
http://
prepended to them. So, simple enough, I went into header.php and removed<?php echo home_url(); ?>
from#logo a
and replaced it with my absolute URL with nohttp://
prepended. My fill animation transition worked beautifully, but there was a huge problem……my logo (that was supposed to link to home) now had a hyperlink of “http://mysite.ext/mysite.ext”. Something in the code was watching for when that anchor
href
didn’t match the site URL and when it didn’t, it prepend that value back on.So I was left with 2 choices:
1) Leave<?php echo home_url(); ?>
alone and suffer defeat at the hands of Chrome and Safari which gave a harsh on/off animation to the fill color transition ( yeah, weirdly enough FireFox had no issue with it).2) Suffer defeat at the hands of Chrome and Safari, and find another way to accomplish what I’m looking to do.
But I decided to kick the door down to option 3, and try to get help hunting down this elusive glitch of a code and try to nullify it. There is absolutely no reason to have something like this in a theme unless you’re trying to make it difficult for less experienced coders to hack, especially a free theme in the WP Repository.
Responsive in the WP Repository
Responsive Website
My Site (I opted for a pure CSS solution for now, which I hate, until this gets resolved)May 12, 2014 at 7:09 am #169867chrisburton
Participantdefeat at the hands of Chrome and Safari which gave a harsh on/off animation to the fill color transition ( yeah, weirdly enough FireFox had no issue with it).
Wait. So it is working in Firefox? Could be a bug then.
I opted for a pure CSS solution for now, which I hate, until this gets resolved
Why do you hate a pure CSS solution? The less jQuery you can use, the better.
May 12, 2014 at 7:17 am #169868bmoneruiux
ParticipantYeah I’m pretty sure it is a bug seeing as how Chroma and Safari were the only ones with the
http://
prepended transition issue.And I meant pure CSS like how my current iteration of the project is. It’s constructed of nothing but DIVs and CSS. No SVG in there anymore (check the site now). And as we all know, CSS can be different depending on the browser viewing it. THis SVG graphic was meant to alleviate this headache for me…but Chrome and Safari are being naughty.
May 12, 2014 at 7:19 am #169869chrisburton
ParticipantCan you create a zip file of your WordPress theme and send me a link?
May 12, 2014 at 7:25 am #169872bmoneruiux
ParticipantIt’s about 1030am my time, and I won’t be back home to do that until around 3-4pm.
May 12, 2014 at 7:28 am #169875chrisburton
ParticipantOk.
May 12, 2014 at 7:52 am #169879chrisburton
Participant@psionicsin Found out the problem.
Edit: Strike my original explanation. The problem is not
<div id="logo">...
However, I have solved it. Trying to figure out the cause.
May 12, 2014 at 8:13 am #169883chrisburton
ParticipantThe problem is not being caused by any Javascript on the page. This one has me stumped. The only other explanation I can think of is that your CSS was overridden.
Demo: http://f.cl.ly/items/3X372k332F2n1m130k2w/svg-logo-animation.mp4
May 12, 2014 at 3:49 pm #169939bmoneruiux
ParticipantHere you go. The URL thing is still happening to me btw.
https://dl.dropboxusercontent.com/u/7223265/brand0nm0n3r.zip
May 12, 2014 at 4:58 pm #169945bmoneruiux
ParticipantUpdate. Every link that I place into header.php gets prepended with my siteURL first.
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.