jquery移除自定义

    技术2022-07-11  151

    jquery移除自定义

    Yesterday I posted an article about how you can use your own "missing image" graphics when an image fails to load using MooTools. Here's how to do the same using jQuery.

    昨天,我发布了一篇文章,介绍了当无法使用MooTools加载图像时如何使用自己的“缺失图像”图形 。 这是使用jQuery执行相同操作的方法。

    View Demo 观看演示

    jQuery JavaScript (The jQuery JavaScript)

    $(document).ready(function() { /* version 1 */ $('img.missing1').error(function() { $(this).attr({ src: 'https://davidwalsh.name/demo/missing-image.jpg', alt: 'Sorry! This image is not available!', style:'border: 1px solid #f00;width:110px;height:40px;' }); }); /* version 2 */ $('img.missing2').error(function() { $(this).attr({ src: 'https://davidwalsh.name/demo/missing-image-2.jpg', alt: 'Sorry! This image is not available!', style:'border: 1px solid #f00;width:30px;height:28px;' }); }); });

    Note that I've provided two examples. If you want to get really specific, you can create multiple images and account for different sizes when possible.

    请注意,我提供了两个示例。 如果您想变得非常具体,则可以创建多个图像并在可能的情况下考虑不同的大小。

    View Demo 观看演示

    A great website accounts for all of the details. This is yet another way of accounting for the finest of details. A website is NEVER complete!

    一个很棒的网站负责所有细节。 这是解释细节的另一种方式。 网站永远不完整!

    翻译自: https://davidwalsh.name/custom-missing-image-jquery

    jquery移除自定义

    相关资源:jdk-8u281-windows-x64.exe
    Processed: 0.010, SQL: 10