Download & Extend

Error: $(settings.targetId).cycle is not a function

Project:Views Slideshow
Version:6.x-3.0
Component:Cycle
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

I've just installed Views Slideshow and I'm trying to get it to work. I've created a View that is supposed to be a single frame slideshow of photos contained within a particular node. I'm pretty sure I have the View set up correctly - I've followed all the instructions I could find here - but the slide show doesn't do anything. It shows one image, and doesn't change. This also happens if I try to make a slideshow that displays article (node) titles.

When I view my slideshow page in Firefox, and look at the Error Console, this is the error message I get:

Error: $(settings.targetId).cycle is not a function
Source File: http://[www.mysite.com]/sites/all/modules/views_slideshow/contrib/views_slideshow_singleframe/views_slideshow.js?7
Line: 88

I checked the page source, and as far as I can tell, all the correct JS files are loaded:

jquery.js
jquery.cycle.all.min.js
views_slideshow.js

I've checked the issues database and can't find anything quite like this. I'm afraid I don't know what else to try at this point.

If you think I've forgotten any details I'll be happy to supply them. Thanks!

Comments

#1

Status:active» postponed (maintainer needs more info)

hmm it seems it should load. Could jquery.cycle be loading twice? Maybe you can try clearing your cache and see if that helps. Is there a site I can look at?

#2

I've just e-mailed you the URL. I would rather not post it on the forum.

Also, for the sake of being thorough, here is the exported View:

<?php
$view
= new view;
$view->name = 'cafes_slideshow';
$view->description = '';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
 
'field_photo_fid' => array(
   
'label' => '',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'link_class' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'target' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'empty' => '',
   
'hide_empty' => 0,
   
'empty_zero' => 0,
   
'link_to_node' => 0,
   
'label_type' => 'none',
   
'format' => 'Cafe_Slideshow_Photo_default',
   
'multiple' => array(
     
'group' => 0,
     
'multiple_number' => '',
     
'multiple_from' => '',
     
'multiple_reversed' => 0,
    ),
   
'exclude' => 0,
   
'id' => 'field_photo_fid',
   
'table' => 'node_data_field_photo',
   
'field' => 'field_photo_fid',
   
'relationship' => 'none',
  ),
 
'field_photo_data' => array(
   
'label' => '',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'link_class' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'target' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'empty' => '',
   
'hide_empty' => 0,
   
'empty_zero' => 0,
   
'link_to_node' => 0,
   
'data_key' => 'description',
   
'exclude' => 0,
   
'id' => 'field_photo_data',
   
'table' => 'node_data_field_photo',
   
'field' => 'field_photo_data',
   
'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
 
'title' => array(
   
'operator' => '=',
   
'value' => 'Cafés Slideshow',
   
'group' => '0',
   
'exposed' => FALSE,
   
'expose' => array(
     
'operator' => FALSE,
     
'label' => '',
    ),
   
'case' => 1,
   
'id' => 'title',
   
'table' => 'node',
   
'field' => 'title',
   
'relationship' => 'none',
  ),
 
'type' => array(
   
'operator' => 'in',
   
'value' => array(
     
'cafes_slideshow' => 'cafes_slideshow',
    ),
   
'group' => '0',
   
'exposed' => FALSE,
   
'expose' => array(
     
'operator' => FALSE,
     
'label' => '',
    ),
   
'id' => 'type',
   
'table' => 'node',
   
'field' => 'type',
   
'relationship' => 'none',
  ),
 
'status' => array(
   
'operator' => '=',
   
'value' => '1',
   
'group' => '0',
   
'exposed' => FALSE,
   
'expose' => array(
     
'operator' => FALSE,
     
'label' => '',
    ),
   
'id' => 'status',
   
'table' => 'node',
   
'field' => 'status',
   
'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
 
'type' => 'none',
));
$handler->override_option('cache', array(
 
'type' => 'none',
));
$handler->override_option('use_ajax', TRUE);
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'slideshow');
$handler->override_option('style_options', array(
 
'grouping' => '',
 
'type' => 'ul',
 
'mode' => 'singleframe',
 
'singleframe' => array(
   
'timeout' => '5000',
   
'delay' => '0',
   
'speed' => '700',
   
'random' => '0',
   
'pause' => '1',
   
'controls' => '0',
   
'pager' => '0',
   
'pager_type' => '0',
   
'pager_hover' => '2',
   
'image_count' => '0',
   
'effect' => 'fade',
   
'sync' => '2',
   
'advanced' => '',
   
'ie' => array(
     
'cleartype' => 'true',
     
'cleartypenobg' => 'false',
    ),
  ),
 
'thumbnailhover' => array(
   
'hover_breakout' => 'teaser',
   
'teasers_last' => 1,
   
'timeout' => '5000',
   
'delay' => '0',
   
'speed' => '300',
   
'random' => '0',
   
'pause' => '',
   
'pager_event' => 'mouseover',
   
'controls' => '0',
   
'image_count' => '0',
   
'effect' => 'fade',
   
'sync' => '2',
   
'advanced' => '',
   
'ie' => array(
     
'cleartype' => 'true',
     
'cleartypenobg' => 'false',
    ),
  ),
));
$handler->override_option('row_options', array(
 
'inline' => array(),
 
'separator' => '',
 
'hide_empty' => 1,
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'slideshow');
$handler->override_option('menu', array(
 
'type' => 'none',
 
'title' => '',
 
'description' => '',
 
'weight' => 0,
 
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
 
'type' => 'none',
 
'title' => '',
 
'description' => '',
 
'weight' => 0,
));
?>

and the View's output:

SELECT node.nid AS nid, node_data_field_photo.field_photo_fid AS node_data_field_photo_field_photo_fid, node_data_field_photo.field_photo_list AS node_data_field_photo_field_photo_list, node_data_field_photo.field_photo_data AS node_data_field_photo_field_photo_data, node_data_field_photo.delta AS node_data_field_photo_delta, node.type AS node_type, node.vid AS node_vid, node_data_field_photo.nid AS node_data_field_photo_nid FROM node node  LEFT JOIN content_field_photo node_data_field_photo ON node.vid = node_data_field_photo.vid WHERE ((node.title) = ('Cafés Slideshow')) AND (node.type in ('cafes_slideshow')) AND (node.status <> 0)

Thanks for the reply!

#3

Oh, and I forgot to mention I cleared the cache. I had high hopes, but no such luck.

#4

Looking at the site it seems jquery is being loaded twice. Can you try to disable the module that is loading it the second time and see if it works.

#5

Oh, I see. I have calls for jQuery in my site.info file. If I remove it the slideshow works, but then that breaks other jQuery-based stuff on the site - specifically my various tabbed menus.

Any thoughts on getting them all to cooperate? Is there a way to get the slideshow to use the jQuery scripts I already have loaded, or to get my tabbed menus to use the jQuery script that the slideshow uses?

I am fairly new to Drupal, so if that's a dumb question then please bear with me.

#6

Status:postponed (maintainer needs more info)» fixed

You can use http://drupal.org/project/jquery_update to manage updating your jquery version in your site.

#7

Excellent - got it working. Thanks!

#8

Status:fixed» closed (fixed)

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

#9

Status:closed (fixed)» active

Same issue is occurring for me and looking at the source, jquery.js is not included twice nor does any js file appear to be. Occurs across different themes. The initial div with the first slide appears, along with controls and slide counter, but the previous pause and next links do not work. They are plain text and even clicking them does not do anything.

On page load I get this error in Firebug Console:

$(settings.targetId).cycle is not a function
  $(settings.targetId).cycle(settings.opts);

Clicking on Next outputs this in Errors Console:

$("#views_slideshow_cycle_teaser_section_" + options.slideshowID).cycle is not a function
  $('#views_slideshow_cycle_teaser_s...+ options.slideshowID).cycle('next');

Same error for Previous and Pause/Resume except the cycle(') portion.

#10

Status:active» closed (fixed)

Didn't realize downloading the .js file was required. Found out via http://www.brightwebsitedesign.com/how-to-install-views-slideshow-module....

You need to download jQuery cycle plugin and copy jquery.cycle.all.min.js to sites/all/libraries/jquery.cycle You can find the plugin at http://malsup.com/jquery/cycle

#11

Another suggestion - I was also getting those errors, even though I had the plugin downloaded. But then i realised the permissions on the default uncompressed jquery.cycle folder was 700 so i changed it to 755 and it worked.

#12

bsuttis,

Hi I am having the same problem with views slide show as you did. It doesn't seem like anyone was able to solve this problem. Did you happen to figure it out? Please let me know if you did thanks.

#13

I had the same issue but then found out I was using an incorrect version of the plugin. Use this one: https://raw.github.com/malsup/cycle/master/jquery.cycle.all.js

#14

I had the same issue and ran some debugging of the code and found that the file that it is looking for is named jquery.cycle.all.min.js (which is what the instructions tells you but who reads those anyways). The file from the link that it provides is jquery.cycle.all.js. Renaming the downloaded file to jquery.cycle.all.min.js worked for me.

#15

#10 The page at that link shows how to install Slideshow for D7. But the tip to install jquery.cycle.all.min.js applies to 6.x-3.x as well. Found it out the hard way :)

#16

Version:6.x-2.0-beta2» 6.x-3.0
Component:Miscellaneous» Documentation
Category:support request» bug report
Status:closed (fixed)» needs work

Hi all.

I'm sorry to be a dork here by re-opening this issue, but I really think this hasn't been addressed properly.

The install of this module should be considered "broken" if a user has to go to Google, type "$(settings.targetId).cycle is not a function" and find this thread, only to read all the way through it and find out he has to download a separate file.

There should at least be a clear paragraph on the module page, like:

Dependency:

Requires you to download the jquery Cycle plugin to sites/all/libraries/jquery.cycle.min.js

Another good thing would be to include a call to drupal_set_message() in the install hook:

<?php
function views_slideshow_install() {
 
drupal_set_message(t("You must download the jQuery Cycle plugin and put it in sites/all/libraries for the Views Slideshow module to work !"), 'warning');
}
?>

I think this is really important. Drupal's goodliness is only as good to newbies as the worst module they have to work with (I'm not saying your module is crap, don't get me wrong here :-) - I'm just saying this generally speaking). So every module should be as clear and as easy as possible, to use and to install.

Cheers.

#17

I'm sure there is something that can go into hook_install or hook_requirements for views_slideshow_cycle. This wouldn't go into views_slideshow module itself.

#18

Component:Documentation» Cycle

@redndahead

You're absolutely right. My mistake :-). Changing the component to "Cycle".

#19

I had to add:

scripts[] = jquery.cycle.all.min.js

Into the .info file to get it working on Drupal 7.

nobody click here