jquerycssshadowbox

Click on overlay div to activate shadowbox with effect


i am trying to create a gallery where i click the on overlay div and thus shadowbox modal opens with corresponding image. here is my markup

 <li class="grow pic">
 <a class="shadowboxLink" href="img/car_details/1large.jpg" rel="shadowbox">
 <div class="overlayForCarDetails"></div>
 <img class="mediumImg" src="img/car_details/1medium.jpg" alt=""></a>
 </li>

Now when i click the a link it works fine. I wanted to add an effect to image on link overlay so i added jquery like this

        $('.shadowboxLink').mouseenter(function () {
            $(this).children('.overlayForCarDetails').css('opacity', '0.7');
            $(this).children('.overlayForCarDetails').next().find('.mediumImg').addClass('zoomed');
        });

but somehow the class is not applied.

the class is

.zoomed {
-moz-transform: scale(1.10);
-webkit-transform: scale(1.10);
-o-transform: scale(1.10);
transform: scale(1.10);
-ms-transform: scale(1.10);
}

Please tell me where am i doing it wrong. thanks.


Solution

  • Try this

     $('.shadowboxLink').mouseenter(function () {
    
                $(this).children('.overlayForCarDetails').css('opacity', '0.7');
                $(this).children('.overlayForCarDetails').next('.mediumImg').addClass('zoomed');
            });