I'm new to this theme and I'm loving it so far!

One little issue:
On the first load of my site (in any browser), the slideshow doesn't load correctly (screenshots attached). All the divs appear on top of each other, and no slider is loaded. This problem is fixed upon refresh. How can I fix this so the slideshow loads first time?

Thanks,
John

CommentFileSizeAuthor
#1 2nd.jpg265.1 KBCorbey
1st.jpg285.75 KBCorbey
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Corbey’s picture

FileSize
265.1 KB

Oops, forgot 2nd screenshot

Corbey’s picture

I've tried moving the slideshow to a system block, fiddled with the .info file order, done a complete reinstall - nothing seems to fix it.
If anyone can help out I'd massively appreciate it! Ideally I want to launch the site tomorrow and don't want to have to change theme.

gtsopour’s picture

Assigned: Unassigned » gtsopour
gtsopour’s picture

Hello Corbey,

I will examine you issue. Please give me some time.

Thanks
/George

Corbey’s picture

Thanks so much! I've postponed the site launch so please don't feel rushed.

Corbey’s picture

Hi,
Any update on this?

gtsopour’s picture

Status: Fixed » Active

Hello Corbey,

This issue (on first load or on page refresh) appears because the slideshow has not an initial fixed height. The slideshow's height determined dynamically by the height of each slider item. This is the default behaviour. Therefore, until the slideshow initialization, you can see all the slider items with their images one below the other.

Corbey, I will suggest you have 2 workarounds for this issue.

1. Define the initial height of slideshow and then let the slideshow to obtain the height of each slider item dynamically.

With this practise, you will define the initial (first) height of slideshow and then the slideshow will work as now. There is not a specific height that you should define, but the initial height should be relative to the height of your first slider item. One normal height for all cases is 300px for example. This is also a good initial height for default CorporateClean's slideshow for example.
Therefore, you should define the initial height inside template.php file (sites/all/themes/corporateclean/template.php) before after:onAfter attribute. The onAfter function calculates and finally defines the height of slideshow based on the height of each slider item

Change from

drupal_add_js('jQuery(document).ready(function($) {  

$("#slideshow").cycle({
	fx:    "'.$effect.'",
	speed:  "slow",
	timeout: "'.$effect_time.'",
	pager:  "#slider-navigation",
	pagerAnchorBuilder: function(idx, slide) {
		return "#slider-navigation li:eq(" + (idx) + ") a";
	},
	after: onAfter
});

function onAfter(curr, next, opts, fwd){
	var $ht = $(this).height();
	$(this).parent().animate({height: $ht});
}

});',
array('type' => 'inline', 'scope' => 'header', 'weight' => 5)
);

To

drupal_add_js('jQuery(document).ready(function($) {  

$("#slideshow").cycle({
	fx:    "'.$effect.'",
	speed:  "slow",
	timeout: "'.$effect_time.'",
	pager:  "#slider-navigation",
	pagerAnchorBuilder: function(idx, slide) {
		return "#slider-navigation li:eq(" + (idx) + ") a";
	},
        height: 300,
	after: onAfter
});

function onAfter(curr, next, opts, fwd){
	var $ht = $(this).height();
	$(this).parent().animate({height: $ht});
}

});',
array('type' => 'inline', 'scope' => 'header', 'weight' => 5)
);

2. Define the initial height and comment the onAfter function in order to achieve a specific slideshow height.

With this practise the slideshow object knows his height by default and there is no need to calculate the slider item's height. You should comment the option after: and add the option height: with your desired height inside the teplate.php file. Your "desired" height must be the greatest of all heights of each slider item. This practise is an already closed (fixed) issue here http://drupal.org/node/1330298

Change from

drupal_add_js('jQuery(document).ready(function($) {  

$("#slideshow").cycle({
	fx:    "'.$effect.'",
	speed:  "slow",
	timeout: "'.$effect_time.'",
	pager:  "#slider-navigation",
	pagerAnchorBuilder: function(idx, slide) {
		return "#slider-navigation li:eq(" + (idx) + ") a";
	},
	after: onAfter
});

function onAfter(curr, next, opts, fwd){
	var $ht = $(this).height();
	$(this).parent().animate({height: $ht});
}

});',
array('type' => 'inline', 'scope' => 'header', 'weight' => 5)
);

To

drupal_add_js('jQuery(document).ready(function($) {  

$("#slideshow").cycle({
	fx:    "'.$effect.'",
	speed:  "slow",
	timeout: "'.$effect_time.'",
	pager:  "#slider-navigation",
	pagerAnchorBuilder: function(idx, slide) {
		return "#slider-navigation li:eq(" + (idx) + ") a";
	},
	//after: onAfter
        height:400
});

function onAfter(curr, next, opts, fwd){
	var $ht = $(this).height();
	$(this).parent().animate({height: $ht});
}

});',
array('type' => 'inline', 'scope' => 'header', 'weight' => 5)
);

You can see all the JQuery Cycle plugin options here http://jquery.malsup.com/cycle/options.html.

Thanks
/George

gtsopour’s picture

Status: Active » Fixed
Issue tags: +corporate, +Corporate Theme, +Corporate Clean Theme

Corbey inform me if you need further assistance.

Thanks
/George

Corbey’s picture

Hi George,

I was getting really confused when testing these fixes for different browsers. Took me a while to figure it out but I found the problem in the end. Basically the above fixes work perfectly

BUT:

When a user loads the site and is not logged in to the site, the slideshow works perfectly first time in all browsers.
When a user loads the site and is logged in from the last visit, the slideshow error still occurs in all browsers (even with the above fixes implemented).

My site is an intranet and most people won't be logging out between visits so this is still an issue for me.

Can you help?

Corbey’s picture

Status: Active » Fixed

Another update:

When a user loads the site and is logged in from the last visit, the slideshow error still occurs in all browsers (even with the above fixes implemented).

I just realised this only happens with the admin account. All other users will see the slideshow as intended on first load with your fix (I used no.1 from #7). I'm not sure why it only happens with the admin account - could be a conflict with the administration menu? (from what I can see, that's the only difference between logging in as a user and logging in as admin. Then again, I'm a newbie..)

I'm the only admin for the site and only I will see the bug so, as far as I'm concerned, this is fixed. Thanks for your help on this - much appreciated & keep up the good work!
John

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gtsopour’s picture

Committed and will be included into next Corporate Clean release:
1. Define the initial height of slideshow and then let the slideshow to obtain the height of each slider item dynamically.

Thanks
/George