Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to Nullify An Event Listener

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #169829
    bmoneruiux
    Participant

    Hey 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?

    #169854
    bmoneruiux
    Participant

    Wow 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 no http:// 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&#8221;. 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)

    #169867
    chrisburton
    Participant

    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).

    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.

    #169868
    bmoneruiux
    Participant

    @chrisburton

    Yeah 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.

    #169869
    chrisburton
    Participant

    Can you create a zip file of your WordPress theme and send me a link?

    #169872
    bmoneruiux
    Participant

    It’s about 1030am my time, and I won’t be back home to do that until around 3-4pm.

    #169875
    chrisburton
    Participant

    Ok.

    #169879
    chrisburton
    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.

    #169883
    chrisburton
    Participant

    The 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

    #169939
    bmoneruiux
    Participant

    @chrisburton

    Here you go. The URL thing is still happening to me btw.

    https://dl.dropboxusercontent.com/u/7223265/brand0nm0n3r.zip

    #169945
    bmoneruiux
    Participant

    @TheDoc @chrisburton

    Update. Every link that I place into header.php gets prepended with my siteURL first.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.