为什么不在我的ipad上加载第一张图片呢

时间:2022-10-12 18:32:49

i have a gallery slider in my project.

我的项目中有一个图片库滑块。

i have tested on my computer and all works fine,

我在电脑上做了测试,一切正常。

but when i tested on my ipad the images for the gallery slider dont load when i open my project.

但是当我在我的ipad上测试的时候,当我打开我的项目的时候,图片滑块不会被加载。

total images in the slider are 62 and have a total of 1.2mb

滑块中的图像总数为62,总共有1.2mb

My Code:

我的代码:

<div class="main">
    <div class="fixed-bar" style="margin-top:40px">
        <ul id="carousel" class="elastislide-list">
            <li><a href="#p1"><img src="imagens/paginas/1.jpg" /></a>
            </li>
            <li><a href="#p2"><img src="imagens/paginas/2.jpg" /></a>
            </li>
            <li><a href="#p3"><img src="imagens/paginas/3.jpg" /></a>
            </li>
            <li><a href="#p4"><img src="imagens/paginas/4.jpg" /></a>
            </li>
        </ul>
    </div>
</div>

Javascript:

Javascript:

$(document).on('pagebeforeshow', function () {
    $('.fixed-bar').hide();
});

$('#carousel').elastislide({
    minItems: 9
});

Preloader:

预紧器:

var images = new Array()
            function preload() {
                for (i = 0; i < preload.arguments.length; i++) {
                    images[i] = new Image()
                    images[i].src = preload.arguments[i]
                }
            }
            preload(
                "imagens/Paginas/1.jpg",
                "imagens/Paginas/2.jpg",
                "imagens/Paginas/3.jpg",
                "imagens/Paginas/4.jpg",
                "imagens/Paginas/5.jpg",
                "imagens/Paginas/6.jpg",
                "imagens/Paginas/7.jpg",
                "imagens/Paginas/8.jpg",
                "imagens/Paginas/9.jpg",
                "imagens/Paginas/10.jpg",
                "imagens/Paginas/11.jpg",
                "imagens/Paginas/12.jpg",
                "imagens/Paginas/13.jpg",
                "imagens/Paginas/14.jpg",
                "imagens/Paginas/15.jpg"
 )

3 个解决方案

#1


5  

I solved my problem.

我解决了我的问题。

what i have done:

我都做了什么:

Before: i had before one html document with several data-role="pages" and the first data-role="page" are my menu where the user can select the options. When the user clicks on one of this options my code was <a href="#p2"></a> , the normal to go to the another page, (Note: only one of this options have to load the images in the gallery in the another page)

之前:我有一个包含多个data-role="pages"的html文档,第一个data-role="page"是我的菜单,用户可以在其中选择选项。当用户单击其中一个选项时,我的代码是,通常会转到另一个页面(注意:只有一个选项必须在另一个页面的图库中加载图像)

After: And now, i have divide this document in two. One document html for only the start page (menu), and the rest of the several data-role="pages" in another document.

之后:现在,我把这份文件分成两份。一个文档html只用于开始页面(菜单),而另一个文档中的其他数据角色=“pages”。

How i have done the call:

我是如何做到这一点的:

i use a popup with new functions and after the use select of one of this i had use this code:

我使用带有新功能的弹出窗口,在使用其中一个后,我使用了这个代码:

<a href="../thisdocument.html" target="_parent"></a>

and the magic is done. without extra code etc.... only load the document html which contains the gallery slider from another sub-folder.

魔术表演完了。没有额外的代码等....只加载包含来自另一个子文件夹的gallery slider的文档html。

#2


1  

Quick try: force the preload of all images. It seems that if your iPad render images at 4th or 5th try, it's because takes his time in load...

快速尝试:强制所有图像的预加载。如果你的iPad在第4次或第5次尝试时渲染图像,那是因为加载需要时间……

You can preload them with something like this:

你可以用这样的东西来预先加载它们:

var images = new Array()
            function preload() {
                for (i = 0; i < preload.arguments.length; i++) {
                    images[i] = new Image()
                    images[i].src = preload.arguments[i]
                }
            }
            preload(
                "http://domain.tld/gallery/image-001.jpg",
                "http://domain.tld/gallery/image-002.jpg",
                "http://domain.tld/gallery/image-003.jpg"
            )

I read the info in this page. There are also other methods to preload images.
I wish this help...

我读了这一页的信息。还有其他方法来预加载图像。我希望这帮助…

#3


0  

The limit for images loaded on iOS Safari is 3 MB for devices running on less than 256 MB RAM and 5 MB running on devices with more than 256 MB RAM.

iossafari上加载的图像的限制是,在256mb内存以下的设备上运行的图像为3mb,在256mb内存以上的设备上运行的图像为5mb。

http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPhone/CreatingContentforSafarioniPhone.html

http://developer.apple.com/library/safari/文档/ AppleApplications /引用/ SafariWebContent / CreatingContentforSafarioniPhone / CreatingContentforSafarioniPhone.html

#1


5  

I solved my problem.

我解决了我的问题。

what i have done:

我都做了什么:

Before: i had before one html document with several data-role="pages" and the first data-role="page" are my menu where the user can select the options. When the user clicks on one of this options my code was <a href="#p2"></a> , the normal to go to the another page, (Note: only one of this options have to load the images in the gallery in the another page)

之前:我有一个包含多个data-role="pages"的html文档,第一个data-role="page"是我的菜单,用户可以在其中选择选项。当用户单击其中一个选项时,我的代码是,通常会转到另一个页面(注意:只有一个选项必须在另一个页面的图库中加载图像)

After: And now, i have divide this document in two. One document html for only the start page (menu), and the rest of the several data-role="pages" in another document.

之后:现在,我把这份文件分成两份。一个文档html只用于开始页面(菜单),而另一个文档中的其他数据角色=“pages”。

How i have done the call:

我是如何做到这一点的:

i use a popup with new functions and after the use select of one of this i had use this code:

我使用带有新功能的弹出窗口,在使用其中一个后,我使用了这个代码:

<a href="../thisdocument.html" target="_parent"></a>

and the magic is done. without extra code etc.... only load the document html which contains the gallery slider from another sub-folder.

魔术表演完了。没有额外的代码等....只加载包含来自另一个子文件夹的gallery slider的文档html。

#2


1  

Quick try: force the preload of all images. It seems that if your iPad render images at 4th or 5th try, it's because takes his time in load...

快速尝试:强制所有图像的预加载。如果你的iPad在第4次或第5次尝试时渲染图像,那是因为加载需要时间……

You can preload them with something like this:

你可以用这样的东西来预先加载它们:

var images = new Array()
            function preload() {
                for (i = 0; i < preload.arguments.length; i++) {
                    images[i] = new Image()
                    images[i].src = preload.arguments[i]
                }
            }
            preload(
                "http://domain.tld/gallery/image-001.jpg",
                "http://domain.tld/gallery/image-002.jpg",
                "http://domain.tld/gallery/image-003.jpg"
            )

I read the info in this page. There are also other methods to preload images.
I wish this help...

我读了这一页的信息。还有其他方法来预加载图像。我希望这帮助…

#3


0  

The limit for images loaded on iOS Safari is 3 MB for devices running on less than 256 MB RAM and 5 MB running on devices with more than 256 MB RAM.

iossafari上加载的图像的限制是,在256mb内存以下的设备上运行的图像为3mb,在256mb内存以上的设备上运行的图像为5mb。

http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/CreatingContentforSafarioniPhone/CreatingContentforSafarioniPhone.html

http://developer.apple.com/library/safari/文档/ AppleApplications /引用/ SafariWebContent / CreatingContentforSafarioniPhone / CreatingContentforSafarioniPhone.html