Hovering over the live preview allows the zoom feature to work flawlessly, but unfortunately,

I recently implemented a zoom on hover feature using code that works perfectly in my Brackets Live Preview environment. However, when I upload the page to my website, the functionality seems to have disappeared. I believe I have included all the necessary code snippets to help identify and solve this issue. Despite the image not enlarging upon hovering as expected, it continues to work flawlessly in Live Preview. Any suggestions or feedback on resolving this problem would be greatly appreciated.

#gallery {
    width: 300px;  
    height: 3600px;
    float: left;
    padding-top: 0px;
    padding-bottom: 20px;
    }
#gallery p:nth-child(2n+4) {
    padding-bottom: 10px;
    margin-bottom: 30px;
    font-family: "jaf-bernina-sans-narrow";
    font-size: .9em;
    border-bottom: 1px solid black;
    }
#centerHover {
    font-family: "jaf-bernina-sans-narrow";
    font-size: .9em;
    line-height: 14px;
    padding: 0 1em 0;
    margin-top: 10px;
    text-align: justify;       
    }
h1 {
    font-size: 1.2em;
    font-variant: small-caps;
    text-align: center;
    padding-top: 9px;
    padding-bottom: 11px;
    border-top: 2px solid #FAA91D !important;
    border-bottom: 2px solid #FAA91D !important;
    }
.img-zoom {
    width: 310px;
    -webkit-transition: all .2s ease-in-out;
    -moz-transition: all .2s ease-in-out;
    -o-transition: all .2s ease-in-out;
    -ms-transition: all .2s ease-in-out;
    }
.transition {
    -webkit-transform: scale(2.5); 
    -moz-transform: scale(2.5);
    -o-transform: scale(2.5);
    transform: scale(2.5);
    }


<div id="gallery">
                <h1>Image Gallery</h1>
                <p id="centerHover">Center image vertically on page and hover to enlarge.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_17981019_ky_christian_war_1197.jpg" class="img-thumbnail" alt="lewis land warrant" width="259" height="387"></p>
                <p>Alexander Lewis's warrant to survey 200 acres of "second rate land" on the west fork of Pond River.  Robert Mosby &#40;among others&#41; was a witness.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_17900212_ky_christian_sur_1197.jpg" class="img-thumbnail" alt="lewis land survey" width="259" height="387"></p> 
                <p>Alexander Lewis's survey dated 12 Feb 1799 for the above warrant.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_18050501_ky_christian_trn_1197.jpg" class="img-thumbnail" alt="lewis land transfer" width="259" height="387"></p>
                <p>Alexander Lewis transferred his 200 acre survey to Benjamin P Campbell on 1 May 1805.  Alexander's son Robert was a witness.  Campbell transferred it to Smith Lofland on 13 Nov 1806.</p>
            </div>

   <script src="jquery.js"></script>  

   <script>

       //THIS IS THE JS FROM THE DEMO

    $(document).ready(function(){
    $('.img-zoom').hover(function() {
        $(this).addClass('transition');

    }, function() {
        $(this).removeClass('transition');
    });
  });

       //THIS IS THE END OF THE JS FROM THE DEMO
</script>

Answer ā„–1

While you've labeled this as jQuery related, there doesn't seem to be any actual jQuery code in your question.

Is jQuery being utilized for hover effects? It may seem trivial, but I once made the error of having jQuery set up locally without uploading the necessary minified file to my server.

Answer ā„–2

You should utilize the property

img-zoom:hover 

rather than just img-zoom

Take a look at this :

#gallery {
    width: 300px;  
    height: 3600px;
    float: left;
    padding-top: 0px;
    padding-bottom: 20px;
    }
#gallery p:nth-child(2n+4) {
    padding-bottom: 10px;
    margin-bottom: 30px;
    font-family: "jaf-bernina-sans-narrow";
    font-size: .9em;
    border-bottom: 1px solid black;
    }
#centerHover {
    font-family: "jaf-bernina-sans-narrow";
    font-size: .9em;
    line-height: 14px;
    padding: 0 1em 0;
    margin-top: 10px;
    text-align: justify;       
    }
h1 {
    font-size: 1.2em;
    font-variant: small-caps;
    text-align: center;
    padding-top: 9px;
    padding-bottom: 11px;
    border-top: 2px solid #FAA91D !important;
    border-bottom: 2px solid #FAA91D !important;
    }
.img-zoom:hover {
    width: 310px;
    -webkit-transition: all .2s ease-in-out;
    -moz-transition: all .2s ease-in-out;
    -o-transition: all .2s ease-in-out;
    -ms-transition: all .2s ease-in-out;
    }
.transition {
    -webkit-transform: scale(2.5); 
    -moz-transform: scale(2.5);
    -o-transform: scale(2.5);
    transform: scale(2.5);
    }
<div id="gallery">
                <h1>Image Gallery</h1>
                <p id="centerHover">Center image vertically on page and hover to enlarge.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_17981019_ky_christian_war_1197.jpg" class="img-thumbnail" alt="lewis land warrant" width="259" height="387"></p>
                <p>Alexander Lewis's warrant to survey 200 acres of "second rate land" on the west fork of Pond River.  Robert Mosby &#40;among others&#41; was a witness.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_17900212_ky_christian_sur_1197.jpg" class="img-thumbnail" alt="lewis land survey" width="259" height="387"></p> 
                <p>Alexander Lewis's survey dated 12 Feb 1799 for the above warrant.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_18050501_ky_christian_trn_1197.jpg" class="img-thumbnail" alt="lewis land transfer" width="259" height="387"></p>
                <p>Alexander Lewis transferred his 200 acre survey to Benjamin P Campbell on 1 May 1805.  Alexander's son Robert was a witness.  Campbell transferred it to Smith Lofland on 13 Nov 1806.</p>
            </div>

Solution 2 :

Using Jquery :

$('.img-zoom').hover(function() {
        $(this).addClass('transition');

    }, function() {
        $(this).removeClass('transition');
    });
#gallery {
    width: 300px;  
    height: 3600px;
    float: left;
    padding-top: 0px;
    padding-bottom: 20px;
    }
#gallery p:nth-child(2n+4) {
    padding-bottom: 10px;
    margin-bottom: 30px;
    font-family: "jaf-bernina-sans-narrow";
    font-size: .9em;
    border-bottom: 1px solid black;
    }
#centerHover {
    font-family: "jaf-bernina-sans-narrow";
    font-size: .9em;
    line-height: 14px;
    padding: 0 1em 0;
    margin-top: 10px;
    text-align: justify;       
    }
h1 {
    font-size: 1.2em;
    font-variant: small-caps;
    text-align: center;
    padding-top: 9px;
    padding-bottom: 11px;
    border-top: 2px solid #FAA91D !important;
    border-bottom: 2px solid #FAA91D !important;
    }
.img-zoom {
    width: 310px;
    -webkit-transition: all .2s ease-in-out;
    -moz-transition: all .2s ease-in-out;
    -o-transition: all .2s ease-in-out;
    -ms-transition: all .2s ease-in-out;
    }
.transition {
    -webkit-transform: scale(2.5); 
    -moz-transform: scale(2.5);
    -o-transform: scale(2.5);
    transform: scale(2.5);
    transform-origin: 0% 40%;
    }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="gallery">
                <h1>Image Gallery</h1>
                <p id="centerHover">Center image vertically on page and hover to enlarge.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_17981019_ky_christian_war_1197.jpg" class="img-thumbnail" alt="lewis land warrant" width="259" height="387"></p>
                <p>Alexander Lewis's warrant to survey 200 acres of "second rate land" on the west fork of Pond River.  Robert Mosby &#40;among others&#41; was a witness.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_17900212_ky_christian_sur_1197.jpg" class="img-thumbnail" alt="lewis land survey" width="259" height="387"></p> 
                <p>Alexander Lewis's survey dated 12 Feb 1799 for the above warrant.</p>
                <p><img class="img-zoom" src="http://bartonlewis.com/_images/pg_p_lewis_alex_18050501_ky_christian_trn_1197.jpg" class="img-thumbnail" alt="lewis land transfer" width="259" height="387"></p>
                <p>Alexander Lewis transferred his 200 acre survey to Benjamin P Campbell on 1 May 1805.  Alexander's son Robert was a witness.  Campbell transferred it to Smith Lofland on 13 Nov 1806.</p>
            </div>

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

Assigning event to the body element

Is there a way to bind an event to the entire page, specifically the html or body tag? I am trying to achieve the following: document.addEventListener('mousemove', function() { alert('a'); }); I want an alert to be triggered whenever ...

Develop a versatile currency symbol mixin that can be used in various small text formats

I am currently working on a website where I need to display prices in multiple locations. To achieve this, I have created a sass mixin that is designed to add the desired currency symbol before the price with a smaller font-size. Below are examples of how ...

In Padrino, where should the access control headers be configured?

When working with Padrino, the placement of access control headers differs from Ruby on Rails. While in Ruby on Rails you typically place them in the Application Controller, in Padrino it may not work when placed inside a Controller method or app.rb. If ...

Enable drawing on a div element and synchronizing it across multiple divs using Javascript and HTML5

I am embarking on a project to create a website that allows users to doodle on an element and share it with others viewing the page using ajax - essentially a small-scale whiteboard feature. While I have a good grasp of HTML, CSS, Javascript (specificall ...

There seems to be an issue with the location.href function in the server-side code of

I'm encountering an issue in the code below where I am attempting to redirect to the login page, but it seems to not be functioning as expected. app.get('/current-pass', (req, res) => { res.sendFile(path.join(staticPath, "currentPass ...

Tips for invoking onClick events for DataTable buttons

Is there a way to implement onClick buttons for column searching in DATATABLES similar to the example shown in the screenshot below? https://i.sstatic.net/sMIYu.png ...

The Boostrap 4 dropdown menu is not fully visible when included in the code

I created a menu using bootstrap and php, which is working perfectly. However, when I include it in another php file, the dropdown items are not visible. I'm unsure if I need to add a div or use something else? This is the code for my menu.php: <b ...

I would like to fade out every element except for the one with the class "this

I need a solution where every div with the class "insegnanti" fades out, except for the one that I clicked on. Here is the script: for(var i=0;i<instructor.length;i++){ $(document).on ("click", ".insegnanti#i"+[i+1], loadSingleIns); el+="<div cl ...

IE6 disrupts stored layouts

I've encountered a strange issue with my design in IE6. It loads perfectly at first, but after reloading it a couple of times, everything suddenly collapses. The strange part is that when I upload an updated version, it fixes the issue, only to break ...

Placing an image at the bottom right corner and layering it behind an svg element

I am currently attempting to position an image behind an angled SVG separator. Our goal is to achieve this look: https://i.sstatic.net/2YnsY.png However, the current display does not meet our expectations as illustrated here: https://i.sstatic.net/5Dssf ...

List of components in a column arrangement, with each row resizing its width to fit the contents within

I am looking to create a vertical list where each row adjusts its width to perfectly fit its content, instead of expanding to fill the container as a default div does. The goal is to accomplish this with just one HTML element for each row, without any add ...

The best method for quickly loading a webpage that is over 20MB in size

My website is a single-page calendar featuring a full year's worth of images. With 344 requests and a total load size of 20MB, the page consists of a simple PHP script without a database. The requests include a CSS file (15KB), 4 JS files (20KB), two ...

Aligning layers of images within a bootstrap column

Attempting to achieve something similar: Check out this Overlaying Image Example The challenge lies in the fact that these are absolutely positioned images, allowing them to overlap. I aim to center these overlapping images within a Bootstrap column as s ...

Creating a dynamic background image for the ul/li div element

As a newcomer to website development, I am currently exploring how to dynamically set images in the ul/li elements within a div. Below is a snippet of the HTML code I have been working on: <div class="results"> <ul class="row"> < ...

Chrome now supports clickable circular canvas corners

I have a unique setup with two canvases. I've customized them to be circular by utilizing the border-radius property. The second canvas is positioned perfectly within the boundaries of the first one using absolute positioning. This is where it gets e ...

Retrieve user information from WordPress database and showcase it on a WordPress webpage

I am currently in the process of creating a WordPress website where I aim to showcase user profiles directly on the homepage by fetching data from the database as members create their profiles. Here's what I have accomplished so far: When someone reg ...

Use CSS to apply a gray overlay to a portion of an image

I'm attempting to add a greyed out effect to specific sections of an image (two stripes on the left and right). Is there a CSS-only solution for achieving this? I am aware that filters can be used (e.g. filter: grayscale(100%)), but I only want certa ...

Guide on How to Include data (PDF Base 64) in angular 6 component

Within my Angular 6 application, I am presenting data (a report) in a new window using the following code snippet. *** The 'result' variable contains Base64 data *** if (result != null) { const pdfWindow = window.open(""); ...

Window Function Implementation in AngularJS Controller

Iā€™m encountering an issue with my AngularJS App involving a window function. Specifically, the problem lies with a window resize function. The function (someFunction()) in the controller is being triggered on every page when it should only be used with ...

Tips for adding an additional div inside a navigation container, evenly spacing objects, and aligning the search bar to the right

I'm currently working on designing a simple navigation bar but I'm facing difficulties in aligning the elements correctly. See my progress here: https://jsfiddle.net/zigzag/bL1jxfax/ Here are my objectives: 1) Ensure that the navigation bar rea ...