我在下面有完整的 jQuery 代码,它使用 UI 位置插件根据偏移量等在网页中定位图标。
虽然这个工作正常,但我在调整浏览器大小时遇到了一些问题,并且没有重新计算图标位置。如何为下面的代码将 .position() 函数绑定到 $(window).resize() 事件?
(function($) {
$(window).load(function(event) {
if ( $(element_selector).length !== 0 && $(title_class_selector).length !== 0 ) {
$(title_class_selector).position({
my: "center",
at: cornerPosition,
offset:"<?php echo $x_coordinates_foradjustment;?> <?php echo $y_coordinates_foradjustment;?>",
of: $(element_selector)
});
}
});
})(jQuery);
我试过把:
$(window).bind('resize',event);
就在关闭 jQuery 之前,它没有帮助。感谢您的任何提示..