Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

jQuery - Image Zoom

Featured Replies

I'm trying to create an effect but I don't have much experience with jQuery.

 

The site I'm working on uses FancyBox and within a popup that I've created, there is an image which needs to stay in it's position but upon hovering, I want it to enlarge the image but it needs to sit on top of the fancybox popup.

 

I understand that I could use addClass to change the positioning but I also want a smooth 'zoom' type effect as well, so what would be the best way to achieving this?

 

Hopefully that made sense, I've drawn up a couple of (crude) images to help.

 

post-10231-0-03065800-1351513571_thumb.jpg

 

post-10231-0-79540400-1351513581_thumb.jpg

  • Author

Actually, just realised I won't be able to do it this way because FancyBox uses an iFrame. So I'm going to do a simple animate on hover but I have another slight problem.

 

I want to fade everything else out while the image resizes, but if I add another animate in the hover state, both hover and hover out are animating. Not quite sure why.

 

My code is here:

 

$('a.zoom').hover(function() {

$this = $(this);

$this.children('img').animate({

width: '452px'

});

$this.siblings().animate({ opacity: 0.25 });

}, function() {

$this = $(this);

$this.children('img').animate({

width: '142px'

});

$this.siblings().animate({ opacity: 1 });

});

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.