Member
Member
mironb   01-04-2011, 12:51
#1

Hi
I would like to have java script "image preloading" effect and "fading in" effect on image page. This effect looks beautyfull when I enable option "Use Galleriffic script" in my zpArdoise theme but I want to have it only on image page. I don't like layout of galleriffic.
Any idea where I have to look in image.php and what to add in code ? Please give me something for start.

Member
Member
mironb   02-04-2011, 10:55
#2

Ok I found this by myself :)
First I had to download script from this page:
http://www.splintered.co.uk/experiments/64/
More informations abut this script you can find on:
http://clagnut.com/sandbox/imagefades/
http://hungred.com/how-to/tutorial-how-does-image-fade-in-when-picture-loaded/

Administrator
Administrator
acrylian   02-04-2011, 11:18
#3

You also could have just looked at the jquery cycle plugin the standard slidesshow uses.

Member
Member
onedimensional   31-01-2014, 07:43
#4

Hi acrylian,

I implemented the javascript mentioned by mironb. It works but I lose color box in the process. How do I use the cycle plugin to do this? Can you point me in the right direction?
Meanwhile, I've already found the link to its website:
``http://jquery.malsup.com/cycle/

Is it as simple as quoting a function like this one in a script?

``$('#fade').cycle();

Appreciate your feedback.

Administrator
Administrator
acrylian   31-01-2014, 11:44
#5

Not sure I understand what the colorbox has to do with this. The cycle plugin is a slider/slideshow plugin and has preloading and several effects among them "fade" in as well.

[quote]Is it as simple as quoting a function like this one in a script?

$('#fade').cycle();
[/quote]
That does not much as you need to define what to cycle through. How to use that script is explained on its site you already found. Of course you should also know a bit how jQuery is used: jquery.com

If you like to replace the default image page with its next/prev you have to rework your theme to do so.

Member
Member
onedimensional   31-01-2014, 22:23
#6

My guess is I lose color box (the ability to open up the single image with the overlay) because of javascript conflicts when using mironb's script above. So I'd like to use the cycle plugin, but I can't get it to "wake up"...

Here's what I'm using IAW the demo of how to fade in the first picture from their website:
``$(function() {

$('#slideshow img:first').fadeIn(1000, function() {

    $('#slideshow').cycle();

});

});``

I've inserted this code on image.php and changed the id of the image accordingly:

``printCustomSizedImageMaxSpace(getBareImageTitle(), 650, 450, false, 'slideshow')

So next I'm thinking well I've got to hide it first with css, and then fadeIn (or .'show'), I've tried the following all successfully hiding the image, but it never appears:

``

$('#slideshow').css('opacity','0');

$('#slideshow').css('visibility','hidden');

$('#slideshow').css('display','none');

[code][/code]

So the complete code in my header section right now looks like this:

[code] $(function() { $('#slideshow').css('opacity','0'); $('#slideshow img:first').fadeIn(1000, function() { $('#slideshow').cycle(); }); }); [/code]

A related question: What is the full file path to the actual plugin?

Thank you again for helping me.

Member
Member
onedimensional   31-01-2014, 23:05
#7

Update:

I haven't figured it out yet... but I can make the image "appear" with this:

`` $(function() {

            $('#slideshow').css('visibility','hidden');

                });

            $(window).load(function() {

                 $('#slideshow').css('visibility','visible')

              });

``

All I'm missing now is the "fade in" or ``show('slow')...

Still eager for your input. thanks

Administrator
Administrator
acrylian   01-02-2014, 00:26
#8

You did understand what the cycle script is for? Did you define slides? Without it does nothing naturally… Please review the docs on the cycle site if that is what you are trying to do.

Member
Member
onedimensional   01-02-2014, 00:32
#9

I'm not trying to do slides... Just like mironb, I'm trying to fade in an image rather than the progressive loading (safari), or the pop-in effect of the browsers. From your response to mironb it seemed to suggest the cycle plugin could achieve this?

Member
Member
onedimensional   01-02-2014, 00:39
#10

please visit my site here (image.php) I have reactivated the javascript that achieves the effect but messes up the overlay when you click for the full-size image:

If it is possible, as suggested to mironb, I would like to do replace the javascript with whatever the cycle plugin can do, and that way regain the color box functionality.

Member
Member
onedimensional   01-02-2014, 04:14
#11

I believe I figured it out...

``

Administrator
Administrator
acrylian   01-02-2014, 11:25
#12

If you are not trying to do slides cycle is not applicable (I didn't look at mironb's script).. The real question is do you want to reload the image page if you click on next/prev or not or just fade in the image.

For the first you have to rework the theme to bypass the default next/prev by using a slider script (This is basically what the galleriffic script does internally as far as I remember). Also the carousel requires another setup.

If you just want the 2nd then hid the image via CSS intitially and fade it in via jQuery fadeIn(). No need for any image loader in this case. Why load the image via js if it is loaded via plain html already.

Member
Member
onedimensional   01-02-2014, 12:20
#13

Yeah I'm totally with you. I want the second one... (Loading the page and fading in the image) I've tried and tried with JQuery and CSS... The closest I got is with... display:none. Unfortunately it collapses the space until the image fades in. I wanted everything to stay put, so like I mentioned above I tried css visibility, and css opacity, but didn't make any further progress. It's sad cause it seems so straightforward, makes me feel rather silly I'm afraid.

Administrator
Administrator
acrylian   01-02-2014, 12:47
#14

Try "visibility" instead of "display" as that saves the space of the hidden element. Of course only if it set to display: block and has width and/or height. Images have not by default as they are actually inline elements. Or create a wrapper around the image to save the space and just hide the image within.

Member
Member
onedimensional   02-02-2014, 05:11
#15

I got it to work! The first part was assigning a height to the "#image div" that is equal to the height setting for pictures. The second part was vertically centering pictures within the "#image div" so nothing on the page moves when you load the next image, and the third part was the following JQuery in the "head" section:

``

    $(document).ready(function() {

        $('#thephoto').css('display','none');

        $(window).scrollTop(250);              *\-->optional, hashtag anchor works too...

            });

    $(window).load(function() {

        $('#thephoto').fadeIn(1500);

            });

``

The final effect simulates the slideshow to near perfection. Thanks again.

Administrator
Administrator
acrylian   02-02-2014, 09:57
#16

Glad you managed it! "Help to help yourself" is the main motto of this forum :-)

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.