Avatar of Tom Powers
Tom Powers asked on

Layer shows and hides locally but not on a public webpage

I created a layer that I want to cover up a section of stats because I have to populate this layer with split stats. Now I got it to work locally but if it's public page it or the image that you click doesn't work any ideas why? I'm using this Real Simple try in locally then here is the public page with same image that I'm using as buttons
http://199.233.14.112/aspdata/mlb2/matchupver2withsplitstats.html

$(document).ready(function() {
   $('#Abutton1').click(function(){
      $('#layer1').show();
   });
   
   $('#Abutton2').click(function(){
      $('#layer1').hide();
   });
});

Open in new window


Don't worry about stats here the goal is to show and hide a layer with a click of a image
matchupver2withsplitstats.html
JavaScriptjQueryXML

Avatar of undefined
Last Comment
Chris Stanyon

8/22/2022 - Mon
ASKER
Tom Powers

I know image is not there but if you click you can see the show and hide locally work. But not Public Web page.
ASKER CERTIFIED SOLUTION
Chris Stanyon

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Tom Powers

Chris I'm still learning should I put #layer1 at top of <body> tag before any html code? Would that be how to go about fixing this problem ?
Chris Stanyon

No, not really. I can't see exactly what you're trying to do, but I would have a table row for the pitchers name and the button, and then one more row containing both sets of stats - call them something easy like layer1 and layer2. Set the CSS of layer2 to display:none; so it can't be seen. Now, the click of your button will need to toggle the display of layer1 and layer2.

Have a look at this code - http://jsfiddle.net/ChrisStanyon/X9RQT/ and ask any questions if it doesn't makes sense.
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER
Tom Powers

Chris helped me fix my problem with a layer. I appreciate it. Good work!
ASKER
Tom Powers

Yo Chris thanks for the link I'm gonna use   Thanks Bro.
$('#button1').click(function() {
    $('#layer1, #layer2').toggle();
});
Chris Stanyon

Cool. Keeps it simple :)
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.