Before you ask please READ THIS

Can you help me override the click handler on the footer switch?

edited June 2016 in Photon Posts: 51
I know this is totally not supported but thought I'd ask in case you have any ideas....

I'm not using the footer widgets so I want to change the footer switch at the bottom to an up arrow that takes you to the top of the page.

I was able to change the icon easily enough in my child theme's style.css:
.icon-switch:before{
  font-family: FontAwesome;
  content: "\f062"; /* top arrow icon */
}
Now all I want is replace it's current click handler with a function that scrolls to the top of the window (window.scrollTo(0,0);)

But I cannot for the life of me figure out how to select that icon in order to put a click handler on it. I tried using jQuery to select on #f-switch, .icon-switch, and even on #footer-msg-indicator (which I think is an Id you add in script.js), but had no luck.

I finally, in desperation, modified your script.js starting at line 1438 to replace your code inside of
else if(!footer.is('.open')){

with a function call to a javascript function I added to scroll to the top.

But this is obviously awful, I don't want to modify the parent theme's code. Do you have any ideas?


Thank you!!
Abby
Post edited by Air on

Comments

  • AirAir
    Posts: 10,970
    Hello there:-)

    Well it is hard to say why your code didn't work, maybe it was not printed in source or there was other issue, I would need to see it live. However it sounds that your approach was correct. Rewriting our function is also good, mainly if you wish to remove current action:-)

    If you like put your code back live and give me a note when it is done.

    With kind regards.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion