Welcome to TalkGraphics.com
Page 7 of 7 FirstFirst ... 567
Results 61 to 69 of 69
  1. #61
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Zoomable image on webpage

    Here is an updated version of my tests. Support for mouse wheel and some support for touch devices were added.
    Tested on vertical supersite, so the code moved to the site head.
    Testing on the tablet has really been a pain.
    As you can see in the example there no longer needs to be a slider and track, and the parameters may be left empty. Please ask if something needs to be explained.
    See example online here.
    Maybe someone has a chance to test on other mobile devices and tell if there are problems?
    Attached Files Attached Files

  2. #62
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Zoomable image on webpage

    I am very sorry. Just noticed there is a problem with IE11. Was testing with IE9, FF, Chrome and Opera all the time.
    Here is a slightly updated version. In the mouse wheel event handlers there now is an additional call of stopPropagation as IE11 seems to ignore preventDefault for wheel events.
    Attached Files Attached Files

  3. #63
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Zoomable image on webpage

    Hi Siran, all three examples work fine on my desktop, but on my iPad the zoom works to an extent but it's not possible to pan.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  4. #64
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Zoomable image on webpage

    Thanks for testing Egg!
    Sorry to hear about the problems on iPad. Any idea what might go wrong (anyone)? Unfortunately I have no Apple device to test on.

  5. #65
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Zoomable image on webpage

    Okay, Zooming & Panning now Siran on iPad & iPhone 4.

    However panning can move the image away from the zoom bar at full zoom out.

    Here's a screengrab:
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	iphone-screengrab.png 
Views:	121 
Size:	163.6 KB 
ID:	114112  
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  6. #66
    Join Date
    Aug 2000
    Location
    Harwich, Essex, England
    Posts
    21,917

    Default Re: Zoomable image on webpage

    Perhaps you need to set up limits to stop the image moving out of the display window, but this wouldn't be simple as it would need to be set dependant on the zoom settings.
    Egg

    Intel i7 - 4790K Quad Core + 16 GB Ram + NVIDIA Geforce GTX 1660 Graphics Card + MSI Optix Mag321 Curv monitor
    + Samsung 970 EVO Plus 500GB SSD + 232 GB SSD + 250 GB SSD portable drive + ISP = BT + Web Hosting = TSO Host

  7. #67
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Zoomable image on webpage

    Thank you again for testing!
    How far can you move it away? That might be what I intended.
    At the moment it is only ensured that the central pixel of the viewport is covered by the picture. That should be the same on desktop browsers.
    Would you prefer it to stay in the viewport when zoomed out? Can try to reimplement that behavior.

    For all those that might be irritated what we are talking about, Egg was so kind to test a development version.

  8. #68
    Join Date
    Apr 2015
    Location
    Germany
    Posts
    927

    Default Re: Zoomable image on webpage

    With Egg's help I have added support for iPad now. And the dragging of the image now considers the edges of the viewport rather than it's center.
    The problem with the iPad seems to have been that during dragging the browser fires mouse events. These were interfering with the way the drag operation was handled.
    So the trick is to stop listening to mouse events when a touch event is received.
    Unfortunately this will also disable mouse events for users that have touch and mouse devices in use at the same time. Not sure if that might be a problem.

    Please have a look at the online example

    During debugging I have created a javascript function that allows to display simple debug output on the screen, please ask if you are interested in that.
    Attached Files Attached Files

  9. #69

    Default Re: Zoomable image on webpage

    Many apologies for the delay but thank you so much for all the help!

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •