• Skip to sidebar navigation
  • Skip to content

Bitbucket

  • More
    ProjectsRepositories
    • Help
      • Online help
      • Learn Git
      • Welcome to Bitbucket
      • Keyboard shortcuts
    • Log In
    Blackrock
    1. Blackrock

    main

    Public
    Actions
    • Clone

    Learn more about cloning repositories

    You have read-only access

    Navigation
    • Source
    • Commits
    • Branches
    • All Branches Graph
    • Graphs
    • Forks
    1. Blackrock
    2. main

    Source

    main/wp-content/plugins/woocommerce/assets/js/zoom/jquery.zoom.js
    Артем ШиряевАртем Ширяев committed 554847ddcb906 Apr 2021
    Raw file
    Source viewDiff to previous
                        .fadeTo($.support.opacity ? settings.duration : 0, 1, $.isFunction(settings.onZoomIn) ? settings.onZoomIn.call(img) : false);
     
    1
    /*!
    2
        Zoom 1.7.21
    3
        license: MIT
    4
        http://www.jacklmoore.com/zoom
    5
    */
    6
    (function ($) {
    7
        var defaults = {
    8
            url: false,
    9
            callback: false,
    10
            target: false,
    11
            duration: 120,
    12
            on: 'mouseover', // other options: grab, click, toggle
    13
            touch: true, // enables a touch fallback
    14
            onZoomIn: false,
    15
            onZoomOut: false,
    16
            magnify: 1
    17
        };
    18
    ​
    19
        // Core Zoom Logic, independent of event listeners.
    20
        $.zoom = function(target, source, img, magnify) {
    21
            var targetHeight,
    22
                targetWidth,
    23
                sourceHeight,
    24
                sourceWidth,
    25
                xRatio,
    26
                yRatio,
    27
                offset,
    28
                $target = $(target),
    29
                position = $target.css('position'),
    30
                $source = $(source);
    31
    ​
    32
            // The parent element needs positioning so that the zoomed element can be correctly positioned within.
    33
            target.style.position = /(absolute|fixed)/.test(position) ? position : 'relative';
    34
            target.style.overflow = 'hidden';
    35
            img.style.width = img.style.height = '';
    36
    ​
    37
            $(img)
    38
                .addClass('zoomImg')
    39
                .css({
    40
                    position: 'absolute',
    41
                    top: 0,
    42
                    left: 0,
    43
                    opacity: 0,
    44
                    width: img.width * magnify,
    45
                    height: img.height * magnify,
    46
                    border: 'none',
    47
                    maxWidth: 'none',
    48
                    maxHeight: 'none'
    49
                })
    50
                .appendTo(target);
    51
    ​
    52
            return {
    53
                init: function() {
    54
                    targetWidth = $target.outerWidth();
    55
                    targetHeight = $target.outerHeight();
    56
    ​
    57
                    if (source === target) {
    58
                        sourceWidth = targetWidth;
    59
                        sourceHeight = targetHeight;
    60
                    } else {
    61
                        sourceWidth = $source.outerWidth();
    62
                        sourceHeight = $source.outerHeight();
    63
                    }
    64
    ​
    65
                    xRatio = (img.width - targetWidth) / sourceWidth;
    66
                    yRatio = (img.height - targetHeight) / sourceHeight;
    67
    ​
    68
                    offset = $source.offset();
    69
                },
    70
                move: function (e) {
    71
                    var left = (e.pageX - offset.left),
    72
                        top = (e.pageY - offset.top);
    73
    ​
    74
                    top = Math.max(Math.min(top, sourceHeight), 0);
    75
                    left = Math.max(Math.min(left, sourceWidth), 0);
    76
    ​
    77
                    img.style.left = (left * -xRatio) + 'px';
    78
                    img.style.top = (top * -yRatio) + 'px';
    79
                }
    80
            };
    81
        };
    82
    ​
    83
        $.fn.zoom = function (options) {
    84
            return this.each(function () {
    85
                var
    86
                settings = $.extend({}, defaults, options || {}),
    87
                //target will display the zoomed image
    88
                target = settings.target && $(settings.target)[0] || this,
    89
                //source will provide zoom location info (thumbnail)
    90
                source = this,
    91
                $source = $(source),
    92
                img = document.createElement('img'),
    • Git repository management for enterprise teams powered by Atlassian Bitbucket
    • Atlassian Bitbucket v5.10.1
    • Documentation
    • Contact Support
    • Request a feature
    • About
    • Contact Atlassian
    Atlassian

    Everything looks good. Well let you know here if theres anything you should know about.