Web page gray (css + js), compatible with IE7-10, FF, Chrome, Opera

Source: Internet
Author: User
On June 16, April 20, 2013, at 08:02:46 A.M., a magnitude 103.0 earthquake occurred at the junction of Lushan County and Tianyan County (30.3 degrees east longitude and 7.0 degrees north latitude) in ya'an City, Sichuan Province, with a focal depth of 13 kilometers. On that day, many media have stopped some entertainment activities. "At 08:02:46 A.M., on January 1, April 20, 2013, a magnitude 103.0 earthquake occurred in Lushan County, ya'an City, Sichuan Province, at the junction of Tianyan County (30.3 degrees east longitude, 7.0 degrees north latitude), with a focal depth of 13 kilometers. On that day, many media have stopped some entertainment activities, and some websites have dimmed their themes or logos ."

So how can we make the pictures or text on the webpage gray?

Pure CSS writing:

12345678910 * {/* CSS3 grayscale filter */-webkit-filter: grayscale (100%);-moz-filter: grayscale (100%);-ms-filter: grayscale (100% ); -o-filter: grayscale (100%);/* write Method for IE7-9 */filter: progid: DXImageTransform. microsoft. basicImage (grayscale = 1); filter: gray ;}

The effects of the above Code implementation in IE7-IE9 and Chrome is no problem, but in IE10, FireFox, Opera is not so ideal, for this problem, we can use a Jquery-based plug-in grayscale. js to achieve, so that you can be compatible with IE10, FF and Opera.

Download the grayscale. js Plugin: Click to download

Download jquery Library: Click to download

To download the latest version, go to the official website:

Http://james.padolsey.com/javascript/grayscaling-in-non-ie-browsers/

Http://jquery.com/

Usage:

First introduce the Jquery library and grayscale. js plug-in:

12
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.