延迟评估的jQuery插件

延迟评估的jQuery插件

本文介绍了用于延迟加载/延迟评估的jQuery插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有这样的jQuery插件吗?

Is there such jQuery plugin?

更具体:我想使用一种简单易用的方法来推迟某些代码的执行,直到真正需要它(某些事件发生)为止.并且,当此事件发生时,推迟的代码应仅执行一次.某种懒惰的初始化.

More specific:I want to use some elegant and easy way to postpone some code execution until it's really needed (some event happens). And when this event happens, the postponed code should get executed only once. Some kind of lazy initialization.

例如,不是在文档准备就绪时而是在用户将鼠标悬停在某个元素上时,对其应用某些动画.

For example, apply some animation to an element not when document is ready, but when user hovers over that element.

我知道如何手动执行此操作,但我不喜欢它,因为在执行匿名函数之前,我必须考虑检查并设置"initialized"标志.我想知道它是否已经完成(无错误,具有一些不错的功能).

I know how to do it the manual way but I don't like it because I have to think about checking and setting 'initialized' flag before executing anonymous function. I was wondering if it's already done (bug free, with some tasty features).

推荐答案

http://plugins.jquery .com/project/LazyReady

懒惰就绪一个旨在延迟代码初始化直到与指定的DOM元素进行交互(悬停/集中)的插件.

Lazy ReadyA plugin designed to delay code initialization until specified DOM element(s) is interacted with (hovered/focused).

这篇关于用于延迟加载/延迟评估的jQuery插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 16:00