background preloader

Jquery

Facebook Twitter

缓冲加载图片的 jQuery 插件 lazyload.js 使用方法详解. Lazy Load 这个 jQuery 插件,是用来缓冲加载图片的插件。

缓冲加载图片的 jQuery 插件 lazyload.js 使用方法详解

如果一篇文章很长有很多图片的话,下载图片就需要很多时间。 而这款插件,会检测你的滚动情况,只有你要看到那个图片的时候,它才会从后台请求下载图片,然后显示出来。 使用这个插件,可以在需要显示图片的时候,才下载图片,所以可以减少服务器的压力,避免不必要的资源下载。 如果一个人不看下面的图片,那加载下面的图片就是一种浪费。 Lazy Load 插件原理 修改目标 img 的 src 属性为 orginal 属性,从而中断图片的加载。 但是现在,很多javascript大牛分析得出,这个插件其实并没有真正的缓加载效果。 问题原因:在新版的浏览器中,即使你删除了 Javascript 控制的 src 属性,浏览器仍然会去加载这个图像。

解决方法:直接修改 HTML 的结构,在 img 标签中添加新的属性,把 src 属性的值指向占位图片,添加 data-original 属性,让其指向真正的图像地址。 例如:<img data-original=“img/example.jpg” src=“img/grey.gif”> 这样我们就需要先分析一下插件的优缺点,再决定是否要使用。 使用: 必须按照这种结构才有实际作用,需要对输出进行定义。 不使用: 增加服务器压力,浪费系统资源。 究竟使用不使用,还是要看你自己的实际需求。 开始使用 lazyload.js 第一步:加载相关文件。 很明显,你要加载jquery和这个插件。 第二步:定义图片结构。 按照官方的建议,定义你的img结构: 第三步:触发这个插件,生效。 激活以下,你就可以在目标中使用了。 $("img.lazy").lazyload(); lazyload.js 高级使用方法: 下面部分来自官方文档,将官方文档进行了一下简单的翻译。 更周全的做法 我们不得不思考这样一个问题。 应对这个问题,我们需要引入 noscript 标签。

提前加载 默认的情况是,当你滚动到图片位置的时候,插件开始加载。 Threshold 这个参数,就是用来提前加载的。 自定义触发事件. 淺談 jQuery圖片延遲載入特效 LazyLoad 原理 @ WordPress, 網站架設, 使用者經驗 - mrmu 網站架設教學. Lazy Load Plugin for jQuery. Lazy Load is delays loading of images in long web pages.

Lazy Load Plugin for jQuery

Images outside of viewport are not loaded until user scrolls to them. This is opposite of image preloading. Using Lazy Load on long web pages will make the page load faster. In some cases it can also help to reduce server load. Plugin is inspired by YUI ImageLoader Utility by Matt Mlinac. For those in hurry there are several demo pages: basic options, with fadein effect, noscript fallback, horizontal scrolling, horizontal scrolling inside container, vertical scrolling inside container, page with gazillion images, load images using timeout and load images using AJAX(H).

When checking the demos clear browser cache between each request. How to Use? Lazy Load depends on jQuery. You must alter your image tags. <img class="lazy" data-original="img/example.jpg" width="640" height="480"> $(function() { $("img.lazy").lazyload(); }); This causes all images of class lazy to be lazy loaded.

PRO TIP! Setting Threshold Event to Trigger Loading. Cloud Zoom 具有四種強大展示效果的圖片放大鏡JQuery套件-JS程式語法-SR網頁設計教學,資源下載 - 13 Best jQuery 360 Degree Image Rotation Plugins. Using JQuery 360 Degree Image Rotation Plugin is the most beautiful and convenient way to display the pictures on the web pages.

13 Best jQuery 360 Degree Image Rotation Plugins

These best 360° pictures allow the user to have a much detailed analysis of the product or article. jQuery Image Rotation Plugins let you display images in any angle 360 degrees, which can be useful for an e-commerce site to help customers look products in detail, from any angle they desire. In this article we have gathered 13 Best jQuery 360 Degree Image Rotation Plugins for our audience, following plugins are capable of displaying images in 360 degree angle. Hope you will choose and use the following 360 degree jQuery plugins according to your needs for your web projects.

If you like the article you might be interested in our other article as well on 15 Best jQuery Image Slider Plugins 1. Reel is an established and the most versatile three-sixty player for jQuery. 2. Spritespin is a jQuery plugin that enables sprite animation in your website. 3. 6. 8. jQuery BlockUI Plugin. The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser[1].

jQuery BlockUI Plugin

When activated, it will prevent user activity with the page (or part of the page) until it is deactivated. BlockUI adds elements to the DOM to give it both the appearance and behavior of blocking user interaction. Usage is very simple; to block user activity for the page: $.blockUI(); Blocking with a custom message: Blocking with custom style: To unblock the page: $.unblockUI(); If you want to use the default settings and have the UI blocked for all ajax requests, it's as easy as this: [jQuery] BlockUI Plugin - 功能完善的頁面、訊息遮罩 - JavaScript 範例 - jsGears.com 技術論壇 - AJAX, JavaScript, jQuery, 網站開發, 前端效能優化. AngularJS 與 SweetAlert 整合範例 (Will 保哥) SweetAlert. A beautiful replacement for Javascript's "Alert" So...

SweetAlert

What does it do? Here’s a comparison of a standard error message. The first one uses the built-in alert-function, while the second is using sweetAlert. Normal alert Code: alert("Oops... Sweet Alert sweetAlert("Oops Pretty cool huh? More examples In these examples, we're using the shorthand function swal to call sweetAlert. Download & install Method 1: Install through bower: $ bower install sweetalert Method 2: Download the sweetAlert CSS and JavaScript files. Configuration Here are the keys that you can use if you pass an object into sweetAlert:

Jquery教學. jQuery浏览器检测代码,JavaScript代码片段分享, - 脚本分享网.