I am currently working on this responsive gallery content and it is working the way I wanted it to. However, I needed to have one of the contents have a content change upon clicking a certain selection This is the working code of the content change. I added it on the main responsive gallery content after checking that it works ok on a separate file.
Is it due to my placing of the content changing script? I tried placing it inside the main script below but it didn't work. I tried creating its own script tag and placed it at the end but same result. Right now, I tried adding it inside the head tag and it still won't work. Can somebody please help me T^T
Kindly click the atkinsons menu since that is where I inserted the content change
Here is the script tag i'm referring to who is responsible for selecting the appropriate pages to change the content.
<!--Content Change Script-->
<script type="text/javascript">
$(document).ready(function() {
$("a").click(function() {
var id = $(this).attr("data-id"); // Using a custom attribute.
$("#pages div").hide(); // gather all the div tags under the element with the id pages and hide them.
$(".div" + id).show(); // Show the div with the class of .divX where X is the number stored in the data-id of the object that was clicked.
});
});
</script>
PROBLEM Under the Atkinsons page, the content is not changing whenever i click the selection. under the first link, the outcome should look like this The title and Page should change whenever I click on the selection.
THE CHANGES I already applied the code advise from the 1st answer below. it is now changing the title upon clicking the selection, but not all section is clickable. I applied the same changes in both codepen and localhost but it produces different clickable links that doesn't work. The random letter not working depends on the size of the window. Also the paragraph is not showing