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
Avatar of Tom Powers
Tom Powers

ASKER

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
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Tom Powers
Tom Powers

ASKER

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 ?
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

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.
Avatar of Tom Powers
Tom Powers

ASKER

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

ASKER

Yo Chris thanks for the link I'm gonna use   Thanks Bro.
$('#button1').click(function() {
    $('#layer1, #layer2').toggle();
});
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Cool. Keeps it simple :)
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo