Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Greetings.
I'm using slideshow since Drupal 4.7 and found that there is no fading autoplay slideshow any more in 5.0 version. This is probably because you decided not to use 3d party javascripts which is right but lack of this functionality is a big loss.
We found a good jquery plugin (innerfade) to implement this and did the following:
1. Download innerfade.js from jquery site (it is very small, only 2.7K) and put it into slideshow directory.
2. Create one more extremely small slides.js:
$(document).ready( function(){
$('#slides').innerfade({
animationtype: 'fade',
speed: 'slow',
timeout: 2000,
type: 'random',
containerheight: '117px'
});
});
3. Override theme_slideshow() function:
function phptemplate_slideshow($element) {
$slideshow = $element['#slideshow'];
$gallery = reset($slideshow['settings']);
$list = array();
$list[] = '<ul id="slides">';
foreach ($gallery['images'] as $i) {
$list[] = '<li><img class="image" src="'. $i['src'] .'" /></li>';
}
$list[] = '</ul>';
drupal_add_js(drupal_get_path('module', 'slideshow') .'/innerfade.js');
drupal_add_js(drupal_get_path('module', 'slideshow') .'/slides.js');
return implode("\r\n", $list);
}
and that's all! Autoplay fading slideshow is working!
I would like to propose you to include this feature into your module, add one more slideshow setting ("fading") if necessary and improve your theme function to detect slideshow mode.
Waiting for your feedback. Thanks!
Comment | File | Size | Author |
---|---|---|---|
#9 | slideshow_styles.zip | 3.83 KB | ardas |
Comments
Comment #1
funkeyrandy CreditAttribution: funkeyrandy commentedi want to do this ...but all i get is a list of images....(the javascript files ARE being called however...)
thanks
Comment #2
ardas CreditAttribution: ardas commentedAre you sure javascript files were correctly included into result page? Please, review them by viewing page source.
If you have just a list of images this means javascript didn't processed it.
ul id="slides" is important!
be sure you put files into proper location.
Comment #3
sliiiiiide CreditAttribution: sliiiiiide commentedThis modification works a treat! One more thing: I'd love to inlcude the slideshow image descriptions (as in the non-fading version). Would be grateful if someone could point me in the right direction - i'm pretty new to php...
Comment #4
ardas CreditAttribution: ardas commentedPatch phptemplate_slideshow() function and dump $element parameter - image titles should be there. If there are no image titles you should read them from database.
For module author ... It looks like a good feature and probably theme function should include image titles as well (ideally there should be a variable to toggle titles).
Comment #5
mancini CreditAttribution: mancini commentedExcuse me, why I have this errors when I submit the slideshow content:
warning: reset(): Passed variable is not an array or object in /var/www/html/modules/slideshow/slideshow.module on line 227.
warning: Invalid argument supplied for foreach() in /var/www/html/modules/slideshow/slideshow.module on line 231.
Would anyone help me? Thank you very much
Comment #6
kkaefer CreditAttribution: kkaefer commentedPlease do not hijack completely unrelated threads.
Comment #7
headkit CreditAttribution: headkit commentedscriptfile is embeded correctly, id=slides is implemented but in firefox there is still shown a list of images...
:-(
Comment #8
headkit CreditAttribution: headkit commentedhm, i changed some settings in slides.js and then it worked. thats fine.
but containerheight: 'auto' does not work - and i need that!
also i want to add the functionality that there is shown the number of pictures and every image has its own link like "1 | 2 | 3 | 4" where a click stops the slideshow and shows the linked picture.
any solutions in that direction yet?
Comment #9
ardas CreditAttribution: ardas commentedGreetings,
I am providing a patch which implements slideshow style feature.
1. Original style called Manual Rotation now.
2. A new Auto Fading style is added and implements the feature discussed above.
3. theme_slideshow now calls either theme('slideshow_manual', ...) or theme('slideshow_auto_fading', ...) depending on style.
Attached archive consists of the following:
1. innerfade.js - jQuery plugin
2. slides.js - Initialization of innerfade (TODO: Customize settings on a node basis)
3. slideshow_install.patch - Patch for hook_install() to add a new style column and update_3() to alter existing table.
4. slideshow_module.patch - Patch to a module.
Comment #10
ardas CreditAttribution: ardas commentedforgot to change status...
Dear kkaefer, if you have any comments or thoughts regarding this patch please share them with me. We are interesting in supporting the module and helping to improve it.
Comment #11
dub4u CreditAttribution: dub4u commentedAgainst which slideshow version is this patch? I have problems applying it:
slideshow.install.rej contains:
I tried against slideshow 5.x-2.0-c and HEAD.
Comment #12
ardas CreditAttribution: ardas commentedI did it against development release which was available when I did the patch.
I made the patch file with Araxis Merge. Could it be a reason?
Comment #13
ardas CreditAttribution: ardas commentedFrom the provided source code I don't see any problems to apply the patch. The new line is "style INTEGER NOT NULL", all other code is the same.
Comment #14
jo1ene CreditAttribution: jo1ene commentedARDAS - I emailed you about this, but I have been finding so many good messages in my spam box that I'm afraid your reply might be lost. Thank you for taking the time to add this feature! I was wondering what it would take ($) and/or are you available to do the same for this project:
http://drupal.org/project/cck_multimage
Comment #15
bappa.sarkar CreditAttribution: bappa.sarkar commentedI have use
1. Innerfade.js
2. slide.js
3. Override theme_slideshow()
I publish 2 slideshows in a single page. One slideshow is ok but the other one giving list of images.
Comment #16
jo1ene CreditAttribution: jo1ene commentedPlease don't hijack this thread's title. This thread is about an autoplay feature. Feel free to submit your findings regarding this patch, but leave the issue title alone.
Comment #17
ardas CreditAttribution: ardas commentedjo1ene, it is impossible to estimate time needed to implement this feature in CCK Multimage module, I've never used it and at the moment I sent a request to this module's author regarding co-maintaining it. I hope I'll be able to provide some patches for this module. I'll contact you shortly when I have some response from him.
Thank you for your interest.
Comment #18
ardas CreditAttribution: ardas commentedbappa.sarkar, please create a separate thread for this issue.
Comment #19
bappa.sarkar CreditAttribution: bappa.sarkar commentedHi ARDAS,
Thanx for your suggesion, But JavaScript always run in single thread. I give some time to fix the problem. I am new in JQuery. After learning some concept of JQuery I found the solution.
=========Solution is=========
Change in slides.js file. I change
$('#slides').innerfade({ -------> $("ul[@id=slides]").innerfade({
Now it is working fine.
Comment #20
ardas CreditAttribution: ardas commentedSorry, but what was the problem? What is the difference between "#slides" and "@id=slides"?
Comment #21
SteelersMobileAdmin CreditAttribution: SteelersMobileAdmin commentedHey guys, this is going to be a dumb question...i do have a good understanding of php, but i dont see what you guys are saying by "Override theme_slideshow()" Where are you referencing this at? should there be a 3rd separate php file or is it the slideshow.module?
the files i have under the slideshow directory are:
slideshow.js
slidshow.admin.inc
slideshow.info
slideshow.css
slideshow.module
innerfade.js
Sorry about this question, but i have spent a few hours and tried a bunch of different things but nothing works.
Thanks,
Oh and im using godaddy to host so i cant use the .install or the .patch
Comment #22
d.sibaud CreditAttribution: d.sibaud commentedHello, a question, when this feature will be committed in the current version or in a development version?
Comment #23
unfeasible CreditAttribution: unfeasible commentedSubscribe. Any patches for the slideshow fade for D6 in the works?
Comment #24
netivajak CreditAttribution: netivajak commentedThe only change for D6 I had to make as far as I recall was to use the theme name as the prefix rather than phptemplate_
So instead of:
phptemplate_slideshow
I used
my_theme_name_I_really_should_make_them_shorter_slideshow
Hope this helps someone.
Comment #25
ymmatt CreditAttribution: ymmatt commentedI applied this patch to Drupal 5.x and it works great except for some styling/flow issues. The footer of the page ends up behind the slideshow, an easy fix was to adjust the container height in slides.js
Also, the first image is styled with the ul dot.
Thanks for the great work!