[support] refreshing jcarousel item list without page reload

Christopher M. Jones cjones at partialflow.com
Thu Nov 18 13:56:53 UTC 2010


This really looks like it could be accomplished using existing tools, 
unless there's other functionality that isn't represented here.

If your carousel is just displaying a list of images then you'd be best 
off attaching those images to a node. Then you would build a view of the 
nodes using imagecache and all the other goodness that comes from that 
approach. Your select list would be, as said in previous posts, an 
exposed views filter.

As an aside, you should be using url() to build your URLs and you may 
want to consider theme('item_list', $awards) to output your ULs. Put 
your styles in an external stylesheet (not inline) so they can be 
aggregated, compressed, and cached, and to keep your dom clean. Also, 
your JQuery should look like this:

Drupal.behaviors.mymethod = function (context) {
   $('#profile-carousel').jcarousel({
      vertical: true
    });
}


On 11/18/2010 08:30 AM, Aldo Martinez Selleras wrote:
> I have create my modulo completly from scratch!
>
> This code, generate the li objects
>
>    for ( $x = 0; $x<  $numero; $x++) {
>      $output .= "\t<li><img src=\"$base_url/sites/default/files/backgrounds/"
> . $awards[$x]['background'] . "\" width=\"75\" height=\"75\" alt=\"".
> $awards[$x]['background'] ."\" /></li>\n\r";
>    }
>
> And I'm loading the carousel like
>
> jQuery(document).ready(function() {
>     jQuery('#profile-carousel').jcarousel({
>          vertical: true
>      });
> });
>
> $output .= "<select id=\"award-type-filter\"
> onchange=\"javascript:refresh_carousel()\">\n\r";
> $output .= "<option value=\"0\">  -- ALL --</option>\n\r";
> foreach ( $atype as $key=>$value ) {
>     $output .= "\t<option value=\"" . $key . "\">" . $value .
> "</option>\n\r";
> }
> $output .= "</select>\n\r";
>
> So, I need the function refresh_carousel() regenerate the ul>  li objects
> and recall de carousel function.
>
> What can I do with JSON data, I not found any way to format it :(
>
> {"1":background1,"2":background2,"3":background3}
>
> And how I wotk with this ?
>
>


More information about the support mailing list