We have a vertical ticker on our site that works perfectly usual. But in case with some AHAH process works on the same page (AHAH form, views qith ajax calls) there are pronlebs. After the AHAH process finished working, ticker starts to duplicate items, sometimes a dozen of same item is produced.

Comments

kt2ssh’s picture

try this trick
change the id of the views-ticker view before running the ajax
$("#views-ticker-vTicker-name").attr('id','abc');

migdesigns’s picture

StatusFileSize
new181.85 KB

This is happening when ever ajax is used, whenever the ticker is on a page with a map, and when a picture is opened in colorbox...I have attached a picture of how it duplicates. Kt2, where would you make that change?

ckng’s picture

Title: Causing duplicates when ajax running on the same page » Conflict with ajax
Version: 6.x-2.0 » 7.x-2.x-dev
Status: Active » Needs review
StatusFileSize
new1.71 KB
new1.95 KB

Ticker will break on any ajax related operation.
Attached patch for D7 and D6, against latest dev.

ltwinner’s picture

Yea have this problem too, its definitely a critical issue, views ticker is effectively broken on any page that uses other AJAX functionality. Is this module even maintained anymore, I see there hasn't been any commits in a year...

lorisbel’s picture

It works for me on D7. Thank you!

japo32’s picture

Thank you! this should be committed to the next dev release.

ckng’s picture

Then help test and mark it as RTBC.

japo32’s picture

Ok I'll gladly do that. But can you guide me on the official steps to do it? is there a correct protocol? Novice here. :)

ckng’s picture

mesch’s picture

Another alternative is to use Drupal 7's new hook_js_alter() hook to modify the javascript, thereby avoiding the need to patch the module.

A site I was helping with recently had a bbc ticker running which acted up when ajax was triggered. The following code snippet did the trick:

/**
 * Implements hook_js_alter()
 */
function [module_or_theme_name]_js_alter(&$Javascript) {
	foreach ($Javascript as $index => $js) {
		// Fix BBC ticker so that it is not triggered by AJAX
		if (is_numeric($index) && strstr($js['data'], '(function($) { Drupal.behaviors.views_ticker_bbc')) {
			// Get the view name
			$view_name = explode('#views-ticker-bbc-', $js['data']);
			$view_name = explode('", startDelay: 10', $view_name[1]);
			$view_name = $view_name[0];
			// Rebuild the inline javascript using the "once()" method
			$Javascript[$index]['data'] = '(function($) { Drupal.behaviors.views_ticker_bbc = { attach: function (context) { $("#views-ticker-bbc-' . $view_name . '").once(function() { var options = { newsList: "#views-ticker-bbc-' . $view_name . '", startDelay: 10, placeHolder1: " |"}; $().newsTicker(options); }); }};})(jQuery);';
		}
	}
}
fullerja’s picture

Re-rolled for coding standards (D7 version only)

bneil’s picture

Status: Needs review » Needs work
bneil’s picture

Status: Needs work » Needs review
bneil’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #11 works well for me. I no longer receive the duplicate nested divs.

  • bneil committed 7ae4aec on 7.x-2.x
    Issue #1395054 by fullerja, ckng | krembo: Fixed Conflict with ajax.
    
bneil’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

gaurav_drupal’s picture

#3 worked for me. Thank You so much. You saved my time.