Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Header configuration & styling (http://forum.bytesforall.com/forumdisplay.php?f=15)
-   -   Stop/pause header image animation after 1 full sequence? (http://forum.bytesforall.com/showthread.php?t=8999)

evster Aug 17, 2010 08:59 PM

Stop/pause header image animation after 1 full sequence?
 
Hi everyone.

Is it possible to get the header animation in the Atahualpa theme to pause it's animation on the final image available?

So, for example, if I have 5 images uploaded in the "header" folder, it will display images 1 through 5 and pause on #5 instead of repeating the cycle over and over?

I believe it's probably just a simple tweak to the script in js.php, but I am not a javascript wiz so I can't seem to figure it out.

Any help in this area would me most appreciated.

Thanks!

juggledad Aug 19, 2010 06:49 PM

Your idea is correct, go into the code and change the loop so it only runs once.

evster Aug 19, 2010 09:30 PM

Thanks for the tip. I've spent a lot of time working with the code in js.php, but I still can't seem to get it to work.

I assume I need to modify the code within the RotateHeaderImages() function?

I kept making changes to that function with no results, and eventually decided to delete the entire function to see what would happen and guess what - nothing changed! The images still loaded and cycled through repeatedly.

Could there be some setting within the Atahualpa theme options that is overriding my work to js.php?

MickR Aug 22, 2010 06:20 PM

Hi evster,

Did you find a solution? Been trying the same myself and can't see where the loop is being actioned.
Would be great if you found a way round it.

Mick.
(Also wondering if it would be a useful option in ATA Header Image configuration settings in some future release).

juggledad Aug 22, 2010 06:41 PM

in version 3.5.3 edit js.php and change lines 56 and 57 from
HTML Code:

                        if (j > (p-1)) j=0
                        t = setTimeout('RotateHeaderImages()', <?php echo $bfa_ata['header_image_javascript']; ?>000)

to
HTML Code:

                        if (j < (p)) {
                        t = setTimeout('RotateHeaderImages()', <?php echo $bfa_ata['header_image_javascript']; ?>
000) }


MickR Aug 22, 2010 07:58 PM

Hi Juggledad,

Thanks for the reply...

I tried the change you suggested, and although it looked like it made sense it didn't actually work as expected (i.e, loop was still running). I then went in search of info relating to cross-slide and found this:

http://codingforums.com/showthread.php?t=192809

That prompted me to make a change in js.php further down (line 67?) as follows:

FROM:
.crossSlide({sleep: <?php echo $bfa_ata['header_image_javascript']; ?>,fade: <?php echo

TO:
.crossSlide({loop:1,sleep: <?php echo $bfa_ata['header_image_javascript']; ?>,fade: <?php echo

Not sure if that's a recommended way, or if there is better, but at least it worked!

Thanks,

Mick.

MickR Aug 23, 2010 04:07 AM

Did some more testing on this one and deduced the following:

Juggledads solution works if the images are rotating with the fade in/fade out option set to '0' (i.e, no fading).

The solution i found works when the fade in/fade out option is set to 1 or above (i.e, header images fading in and out).

Basically looks like the theme calls the cross-slide function when fading required, and the loop is actioned /controlled within cross-slide using a value passed by js.php. If no fading required the loop to cycle the header images is within js.php itself.

juggledad Aug 23, 2010 04:21 AM

You beat me too it, I was just going to point that out. Good work!

evster Aug 23, 2010 04:45 PM

juggledad and MickR you guys seriously rock!!!

MickR I think you hit the issue I was having right on the head. I had the fade set to 2 seconds, so it was skipping that loop and nothing was happening despite my numerous changes. I added the "loop:1" bit you suggested and it worked like a charm.

Thank you so much for your help in figuring that out. I knew I was close, but like I said I'm not quite a JS master.

juggledad - I'm donating to your beer/coffee fund.

evster Aug 23, 2010 04:53 PM

Also just want to throw in my 2 cents that I agree this would be a nice option built into the admin panel of future releases.

Thanks.

MickR Aug 25, 2010 05:53 PM

Juggledad and Evster - a bit of extra info....

You may have noticed that a random header image flicks in briefly on a page load before the fading cycle starts with cross-slide. It's a bit of an annoying aspect so i've been trying to prevent it.

From what i can see bfa_header_config.php outputs the imagecontainer div and at the same time specifies a background image. I think this happens before the cross-slide function kicks in and then the background images are called again? hence the effect above.

I made the following change to bfa_header_config.php and it looks like it solved it (Line 312 onwards):

// Header Image
if ( strpos($header_items,'%image') !== FALSE ) {

ob_start();

$bfa_header_images = bfa_rotating_header_images();

if ($bfa_ata['header_image_javascript'] != "0" AND $bfa_ata['crossslide_fade'] != "0")
{echo '<div id="imagecontainer" class="header-image-container">';}

else

{echo '<div id="imagecontainer" class="header-image-container" style="background: url(' .
$bfa_header_images[array_rand($bfa_header_images)] . ') ' . $bfa_ata['headerimage_alignment'] . ' no-repeat;">';}


The change checks to see if rotating fading images are required, and if so bfa_header_config echoes the div without specifying the background image. If rotating fading images not required it outputs the theme's original code.

Hope that makes sense, and if i'm missing anything or anyone comes up with a better way let me know. Maybe also an area to add to Flynns bug list?

evster Aug 31, 2010 11:50 AM

Thanks MickR!

I did indeed notice that annoying image flick problem. I don't like it but so far I've been willing to live with it because I wasn't sure how to fix it on my own.

I will try out your solution and see how it goes.

Sven Sep 5, 2010 06:22 AM

Well, I was going to reply, but the forum timed me out so i shall not.


All times are GMT -6. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.