jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery – 如何基于它被称为From的元素来定位Fancybox大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在试图弄清楚如何调用@R_419_1134@,使其出现在调用它的元素(锚标记)旁边.

$("a.fancylink").@R_419_1134@({
    'width' : 560,'height' : 340,'transitionIn' : 'fade','transitionOut' : 'fade','speedIn' : 600,'speedOut' : 200,'overlayShow' : false,'centerOnScroll' : false
});

我知道我可以通过OnComplete调用定位@R_419_1134@,但随后它会从中心到目的地.

任何人都知道如何编写@R_419_1134@调用以使其打开,说它从它触发的元素的左侧或右侧?

任何帮助是极大的赞赏.谢谢!

解决方法

这似乎工作正常:

//pass in the id of the link that was clicked and set the width and height for the iframe   
$.fn.@R_419_1134@_new = function (options) {
    for (i = 0; i < this.length; i++) {
        options._id = $(this[i]).attr("id");
        $(this[i]).@R_419_1134@(options);
    }
};

$("a[rel*=@R_419_1134@]").@R_419_1134@_new({
    onStart: function () {
            $('#@R_419_1134@-wrap').addClass("formWin");
            //create a style that will position the fancy Box relative to the element that clicked it.
            if (this._id != "" && !$(this).hasClass(this._id)) {
                var pos = $("#" + this._id).position();
                var mRight = parseInt($("#" + this._id).css("margin-right").replace("px").replace("auto","0")) + parseInt($("#" + this._id).css("padding-right").replace("px","").replace("auto","0")) + parseInt($("#" + this._id).css("margin-left").replace("px","0")) + parseInt($("#" + this._id).css("padding-left").replace("px","0"));
                var mTop = parseInt($("#" + this._id).css("margin-top").replace("px","0")) + parseInt($("#" + this._id).css("padding-top").replace("px","0")) + parseInt($("#" + this._id).css("margin-bottom").replace("px","0")) + parseInt($("#" + this._id).css("padding-bottom").replace("px","0"));
                var styleTag = '<style type="text/css">.' + this._id + ' { top: ' + (pos.top + $("#" + this._id).height() + mTop) + 'px !important; right: ' + ($("#mainContainer").width() - pos.left - $("#" + this._id).width() - mRight + (($("body").width() - $("#mainContainer").width()) / 2)).toString() + 'px !important; left:auto !important; }</style>';
                $("head").append(styleTag);
                $('#@R_419_1134@-wrap').addClass(this._id);
            }
        }
    }
});

大佬总结

以上是大佬教程为你收集整理的jquery – 如何基于它被称为From的元素来定位Fancybox全部内容,希望文章能够帮你解决jquery – 如何基于它被称为From的元素来定位Fancybox所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。