<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/**
 * Created by fuximin on 2019/9/20.
 */
$(function(){
    $.fn.extend({
        "suspensionTips": function (options) {
            var tips = {
                config : {
                    verticalMargin : 13, // åž‚ç›´è¾¹è·
                    horizontalMargin: 13, // æ°´å¹³è¾¹è·
                    position: 'top', // æµ®åŠ¨ä½ç½®, é»˜è®¤ä¸Šæ–¹,æ”¯æŒtopã€bottomã€leftã€right
                    sharpX : 23, // Tipsçªå‡ºéƒ¨åˆ†ä¸­å¿ƒåº—è·ç¦»å·¦å³ä¸¤è¾¹çš„é•¿åº¦
                    sharpY : 20, // Tipsçªå‡ºéƒ¨åˆ†ä¸­å¿ƒåº—è·ç¦»ä¸Šè¾¹çš„é«˜åº¦
                    content: "",
                    positionClass : 'common-tips'

                },
                init : function (options) {
                    this.config.positionClass = 'common-tips'
                    this.config = $.extend({}, this.config, options);
                    var div = $("&lt;div&gt;&lt;/div&gt;");
                    div.addClass("common-tips-container common-tips-hide");
                    div.text(this.config.content);
                    div.attr("id","common-tips");
                    $(document.body).append(div);
                    div.css({
                        "width" : this.config.width + "px",
                        // "animation":"common-tips-show " + this.config.speed + "s ease-in",
                        // "-webkit-animation":"common-tips-show " + this.config.speed + "s ease-in",
                    });
                    this.calcTop(div);
                    this.calcLeft(div);

                    div.addClass("common-tips-animation");
                    div.addClass(this.config.positionClass);
                    div.removeClass("common-tips-hide");
                },
                calcTop : function(tipsDiv){
                    //è®¡ç®—topä½ç½®
                    var top = this.config.elementPosition.top - tipsDiv.outerHeight() - this.config.verticalMargin;
                    if(this.config.mousePosition.top &lt; (tipsDiv.outerHeight() + this.config.verticalMargin) || this.config.position == "bottom"){
                        top = top + tipsDiv.outerHeight() + this.config.verticalMargin + this.config.elementHeight + this.config.verticalMargin;
                        // tipsDiv.addClass("common-tips-bottom-left");
                        this.config.positionClass += '-bottom';
                    }else{
                        this.config.positionClass += '-top';
                    }

                    if(this.config.position == "left" || this.config.position == "right"){
                        top = this.config.elementPosition.top + this.config.elementHeightHalf - this.config.sharpY;
                    }

                    tipsDiv.css("top", top);
                },
                calcLeft : function (tipsDiv) {
                    //è®¡ç®—leftä½ç½®
                    var left = 0;
                    var windowWidth = window.innerWidth;//document.body.offsetWidth;
                    var marginRight = windowWidth - this.config.mousePosition.left;
                    if(this.config.position == "top" || this.config.position == "bottom"){
                        if(marginRight &lt; (tipsDiv.outerWidth() - this.config.sharpX)){
                            //å¦‚æžœé¼&nbsp;æ&nbsp;‡å±€é‡Œå³è¾¹çš„è·ç¦»å°äºŽtipsæ¡†çš„å®½åº¦ï¼Œåˆ™è¡¨ç¤ºæ”¾ä¸ä¸‹äº†ï¼Œé‚£ä¹ˆå°±åº”è¯¥å¾€å·¦è¾¹å
                            left = this.config.elementPosition.left - tipsDiv.outerWidth() + this.config.sharpX + this.config.elementWidthHalf;
                            this.config.positionClass += '-left';
                        }else{
                            left = this.config.elementPosition.left + this.config.elementWidthHalf - this.config.sharpX;
                            this.config.positionClass += '-right';
                        }
                    }else if(this.config.position == "left"){
                        if(this.config.mousePosition.left &lt; tipsDiv.outerWidth()){
                            //é¼&nbsp;æ&nbsp;‡çš„åæ&nbsp;‡ä½ç½®å°äºŽdivçš„å®½åº¦å°±å¾—å‡ºçŽ°åœ¨å³è¾¹
                            this.config.positionClass = "common-tips-right-right";
                            left = this.config.elementPosition.left + this.config.elementWidth + this.config.horizontalMargin;
                        }else{
                            //å¦åˆ™åœ¨å·¦è¾¹
                            this.config.positionClass = "common-tips-left-left";
                            left = this.config.elementPosition.left - tipsDiv.outerWidth() - this.config.horizontalMargin;

                        }
                    }else{
                        this.config.positionClass = "common-tips-right-right";
                        left = this.config.elementPosition.left + this.config.elementWidth + this.config.horizontalMargin;
                    }

                    tipsDiv.css("left", left);
                }
            }
            $(this).on("mouseover", function(e){
                var mousePosition = {
                    top : e.clientY - e.offsetY,
                    left : e.clientX - e.offsetX + $(this).outerWidth()/2
                };
                options.element=$(this);
                options.elementPosition= $(this).offset();
                options.elementWidth=$(this).outerWidth();
                options.elementWidthHalf=$(this).outerWidth()/2;
                options.elementHeight = $(this).outerHeight();
                options.elementHeightHalf = $(this).outerHeight()/2;
                options.mousePosition = mousePosition;
                // options.positionClass = 'common-tips';
                tips.init(options);

            });
            $(this).on("mouseout", function(){
                $("#common-tips").addClass("common-tips-container-hide");
                document.getElementById("common-tips").addEventListener('webkitAnimationEnd', function () {
                   $("#common-tips").remove();
                }, false);
            });
        }
    });
    $(".slider-mouse").suspensionTips({"content": $(".slider-mouse").data('mobile'), position:"top"});
});

</pre></body></html>