"Adding jQuery functionality: displaying images in a popup on the same

Greetings to everyone here, it's my first time posting but I've been following some posts from time to time. So, hello all!

I have a quick question that I haven't been able to find the answer for online. I'm dismantling a template to use it in rebuilding my website as a single page with links to hidden subpages. I want to keep it simple.

However, I'm facing an issue with setting up a picture link in the gallery to open a page instead of the original .png file for information. While I prefer the .png route, I need to include links to external pages and videos, so a picture link to a subpage is necessary rather than to a .png file.

Here is a link [.zip at 3.4mb] to the actual template that you can download and experiment with to understand what I mean:

It's probably easy and just my luck that I can't figure it out. I've spent a lot of time searching for answers and trying different approaches, but no luck. That's why I decided to ask here.

Thank you in advance for any help.

Lewis Edwards

smokingbunny.co.uk

Answer №1

To start, you must deactivate the lightbox plugin to prevent the function from triggering when clicking on your image.

Edit or disable the line

$('#img_slider li .pic').fancybox({'titlePosition': 'inside', 'overlayColor':'#000'});
found on line 88 of scripts.js

Then, you can connect your subpages by utilizing the current picHold div. Assign an ID/href (where it should link) to the anchor.

    <div class="picHold">
<a id="mySubpage" class="pic" rel="Appendix" href="#!/mySubpage"><span class="zoomSp"></span><img src="images/galleryIcon1.jpg" alt=""></a>
</div> 

After that, duplicate your other content containers (li) and assign the newly created ID to them.

For example:

            <li id="mySubpage">
                   <div class="box">
                        <div class="closePlane">
                            <a class="closeButton" href="#!/pageGallery"><img src="images/closeIcon.png" alt=""></a>
                     </div>
                    <div class="containerContent">
                    <h2>Subpage Policy</h2>
                        <div class="col1">
                            <div class="Btns1">
                                <a href="#" class="upBtn"></a>
                                <a href="#" class="downBtn"></a>
                            </div>
                            <div class="scroll1">

                                <p class="padBot4">Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
                                <p class="padBot4">At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus. Duis autem vel eum iriure dolor in hendrerit.</p>
                                <p>Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.</p>
                            </div>
                        </div> 
                    </div>
               </div>
            </li>   

Follow these steps, and your setup will be complete! All tested and functioning properly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Clone the children of an li element using jQuery, modify the text within a child tag, and then add it to

I have some awesome CSS that I want to recycle within a <ul>. My plan is to duplicate an existing <li> (to leverage the CSS), modify a <p> element, and then add it at the end of the <ul>. I believe I can achieve this by locating... ...

ajax duplicator and reset form tool

Hello everyone, I have a website where users can add their experiences. While adding an experience, they can dynamically add and remove more fields. One of the input fields is for a date, but when the data is submitted, the same date appears for all entrie ...

Generating an SQL query that produces interactive buttons that users can click with the goal of potentially altering the contents of a DIV element

I'm having some trouble explaining this, but here it goes.. My home.php file looks like this: <body> <div id='leftColumn'> <?php include ('includes/roomQuery.php') </div> ...

Can JQuery's $(document).ready function be used exclusively within an HTML file?

When it comes to implementing JQuery scripts for functionalities such as navigation menus, what is the commonly accepted practice? Should the script be directly inserted into the HTML file or should it be linked in the head section instead? Furthermore, ...

How can I remove specific search results in a jQuery / AJAX app?

I have implemented some jQuery and AJAX to call a custom PHP function that fetches API data without refreshing the page. The results are appended, allowing for multiple searches without losing previous results. Now, I am looking to provide users with the ...

What is the best way to pass card data between Vue.js components?

My application consists of two components: DisplayNotes.vue, which displays data in card format retrieved from the backend, and UpdateNotes.vue, which allows users to update existing data by opening a popup. The issue I'm facing is that when a user cl ...

CSS: Ensuring the width is adjusted to the content or wrapper that is wider

I am facing an issue with mouse-over highlighting on a set of list items. Below is the HTML structure I am working with: <div id="wrapper"> <div id="box"> <div class="item">Lorem ipsum dolor sit amet, sit nonumy utamur ponderum ex& ...

Is there a bug in Internet Explorer 8 with jQuery's animated show() method

Recently, I was experimenting with the jQuery function .show(100) to create animations on a webpage. Surprisingly, the animation worked perfectly fine in both Firefox and IE8. However, I noticed that when the animation was applied in IE8, the rendered font ...

Use custom styles or CSS for the file input element: <input type="file">

Can CSS be used to achieve consistent styling for <input type="file"> in all browsers? ...

Steps to transfer selected autocomplete value ID to data attribute using jQuery

I am working on a project where I need to store the State ID in my database instead of the State Name. Currently, I am using an autocomplete query to select the State. How can I pass the selected State's respective ID to the data-attribute of the inpu ...

Maintaining the state of perspectives

I am currently working on an app that utilizes a form to filter objects from a database. Each change in the form triggers a request to the server for filtered objects, which are then displayed in another view. However, I have encountered an issue where the ...

Create a list item that includes an image with a corresponding label positioned beneath it

Currently attempting to convert my design into HTML and CSS for the first time, I've hit a roadblock with this particular task: I'm trying to create a series of white boxes, with each item having a white border. However, I'm struggling to c ...

Is there a way to conceal an element using identical markup with jquery?

Having trouble with two custom dropdown lists that share the same markup. Ideally, only one should be visible at a time. However, both are currently opening simultaneously. Additionally, I need them to close when clicking outside of the list. It's ne ...

Achieving vertical alignment and stretching of subchild within a flexbox element

I am in the process of creating a mobile navigation menu using Flexbox. It will be a vertical menu that occupies 100% of the available height, with the navigation items evenly spaced and taking up the entire height. The structure I am using is ul>li> ...

Tips for creating a wide mobile menu

I am attempting to make the mobile menu full width, but so far my efforts have been unsuccessful. #menu-main-2 { background-color:#FFFFFF !important; padding-left:15px; max-width: unset; width: 100%; } view mobile menu ...

What is the best way to place each gallery image into a specific div in Wordpress?

I am attempting to replicate the Masonry gallery showcased at this link. To achieve this, I have created a Custom Post Type (CPT) called "Gallery". Initially, I considered creating a Custom Post Type to consolidate all images in one place. My CPT fields: ...

Automatically adjust CSS grid to fill based on the width of child elements

Can a CSS grid adjust its widths dynamically based on the content of its children? I believe not, but I wanted to confirm. I attempted this approach without success. const Grid = styled.div` display: grid; grid-auto-flow: row; grid-template-columns ...

Abandoned <li> and </li> elements

I've come across some HTML code where orphaned <li> and </li> tags are surrounding certain paragraphs without any corresponding opening or closing <ul> or <ol> tags. Is there a way to efficiently parse or mass find/replace ove ...

The CSS isn't functioning correctly in the HTML file as it is in the CSS file

When I added this code directly to my html file, it worked perfectly: <style type="text/css" media="screen"> #headerimg { display: block; background-image: url('/Content/images/epp/ebweblogo1.gif'); background- ...

IE11 React application cannot recognize the <main> tag

When using my React application, I encountered the following error message in the dev console while using IE11: Warning: The tag <main> is unrecognized in this browser. If you meant to render a React component, start its name with an uppercase let ...