Skip to main content
Topic: News Fader Quirks (Read 2489 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

News Fader Quirks

A few quirks regarding the news fader.

1) I only have one news item and the fader decides to fade in and out showing the same item over and over.  The fader should probably not do anything if there are 0 or 1 news items.

2) I don't actually have the fader turned on, I have the theme set to random.  But if I use the header up shrink button when I unshrink the header the javascript starts the fader even though the theme is set not to use it.


Re: News Fader Quirks

Reply #2

I think there is a Codeline missing in index.template.php
Add:
Code: [Select]
if ($settings['enable_news'] == 2 && empty($context['minmax_preferences']['upshrink']))
above:
Code: [Select]
	addInlineJavascript('
$(\'#elkFadeScroller\').Elk_NewsFader();', true);

Re: News Fader Quirks

Reply #3

Yeah, I know it's a kind of trick what I did there... O:-)
The problem adding that if is that the moment you expand the header, the news fader would not be initialized. So I'd have to add the initialization on the "expand" action, but then it could be tricky if you expand and collapse and expand again, because the news fader would be initialized multiple times on the same item, etc.
It's a kind of trade-off...

Of course this comes with the usual disclaimer: I hate javascript, so I may be terribly wrong. :P
Bugs creator.
Features destroyer.
Template killer.

Re: News Fader Quirks

Reply #4

 glimpse

I divined its a little more complicated.

Re: News Fader Quirks

Reply #5

lol

 emanuele is able to make things complicated at will! :P

Actually... sorry, today I'm a bit slow (it's the truth, my brain didn't wake up this morning), and now that I re-read your message I feel I understood it wrong. I'll check again tomorrow. lol

...heck, didn't I remove moderators from the linktree a while ago? Why they are still popping around? (Reminder: Display has (still) moderators in the linktree.)
Bugs creator.
Features destroyer.
Template killer.

Re: News Fader Quirks

Reply #6

So this seems to be alive again in RC1.  My one and only one news item is fading in and out even though there is nothing to cycle between.  This is on _light.

Re: News Fader Quirks

Reply #7

ARG!
Sorry, my fault...

Try this: in elk_jquery_plugins.js, at the very end, replace the entire plugin with:
Code: [Select]
;(function($) {
$.fn.Elk_NewsFader = function(options) {
var settings = {
'iFadeDelay': 5000,
'iFadeSpeed': 1000
},
iFadeIndex = 0,
$news = $(this).find('li');

if ($news.lenght > 1)
{
$.extend(settings, options);
$news.each(function() {
$(this).fadeOut();
});
$news.eq(0).fadeIn(settings.iFadeSpeed);

setInterval(function() {
$($news[iFadeIndex]).fadeOut(settings.iFadeSpeed, function() {
iFadeIndex++;

if (iFadeIndex == $news.length)
iFadeIndex = 0;

$($news[iFadeIndex]).fadeIn(settings.iFadeSpeed);
});
}, settings.iFadeSpeed + settings.iFadeDelay);
}

return this;
};
})(jQuery);
Bugs creator.
Features destroyer.
Template killer.

Re: News Fader Quirks

Reply #8

Seems to work with a single news item showing solid.  Not tested with multiple items.

 

Re: News Fader Quirks

Reply #9

Ooops was buggy because of a typo on "length". :-[
Bugs creator.
Features destroyer.
Template killer.