• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

Modifying the amount of horizontal travel in a dynamic ajax carousel.

Please take a look at this question which has already been answered : http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_24136005.html#a23619574

Can you tell me what part of what code determines the number of images that are moved over with every click? The default is to three. What line of code (in what file) would I modify to make that 2 images per click or one image? I thought I might find it in the ajax text file, but I couldn't. And the jquery files are a little overwhelmong for me at this point.

Thanks!
John
0
gabrielPennyback
Asked:
gabrielPennyback
  • 5
  • 5
  • 4
3 Solutions
 
ali_pakkanCommented:
For the example on "http://sorgalla.com/projects/jcarousel/examples/dynamic_ajax.html"..

You can change the behaviour playing with "width" attributes in the following styles:

jcarousel-container-horizontal
jcarousel-clip-horizontal

on

http://sorgalla.com/projects/jcarousel/skins/ie7/skin.css
0
 
gabrielPennybackAuthor Commented:
Unfortunately doing that just changes the width of the container or the clip. I want the container and clip to have the same width, i just want to know how to move the clip by one or two pictures instead ofthree.
In other words as it is now, when the page loads you see three images, 1, 2, and 3. When you click on the right arrow, all three shift to the left and now we see images 4, 5, and 6.
I want to know what line of code to change so that when we click the arrow, we see images 3, 4, and 5  or  images 2, 3 , and 4.
Thanks,
John
0
 
sosamvCommented:
Hi there! i think i'be found that variable you're looking for, please provide a zip file with all of the files from your project (all javascripts and example html). The main Javascript (../lib/jquery.jcarousel.pack.js) is compressed using a javascript compressor found on this link: http://dean.edwards.name/packer/ 

thats the reason why its difficult to modify the script, if you post the files i can decrypt it using that same page and help you with the changes.

Ciaoo!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
sosamvCommented:
ups i've found it on http://sorgalla.com/projects/jcarousel/   LOL hehe, let me take a look ;)
0
 
ali_pakkanCommented:
sosamv's right.. on that site is the parameter you're looking for..

scroll (default:3):         The number of items to scroll by.

0
 
sosamvCommented:
Tried with that one, but thats the number of items it scrolls per click, but the same 3 items are showing :S
0
 
gabrielPennybackAuthor Commented:
I don't have a zip utility that works right now, but you can download all the active files from the html: http://www.discretedata.com/JCRD/Carousels/dynamicAjaxJC1.html. Please take a look and let me know if you can see where to make the change from 3 slides to 2 or 1.
Thanks. -John
I couldn't figure out which file had the scroll (default:3) in it, although it sounds like that doesn't work anyway.
0
 
ali_pakkanCommented:
scroll at that point:

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        itemLoadCallback: mycarousel_itemLoadCallback,
        scroll: 1
    });
});

Open in new window

0
 
gabrielPennybackAuthor Commented:
What file is that in? I couldn't find it in my html.
 
0
 
gabrielPennybackAuthor Commented:
Okay I can see where that fits in now, but what was making it default to 3 in the first place?
In other words which file contains the line <  scroll (default:3):  >? I can see from sosamv's link that you can set the scroll number in the Configuration file, but where is that file vis a vis my version of the carousel?
Thanks,
John
0
 
ali_pakkanCommented:
You mean the default value.. It must be in jquery.jcarousel.pack.js.. Yet, since it is packed, it'll not be easy to find it :)..

I downloaded the unpacked normal version and in that file, you can see it..



    // Default configuration properties.
    var defaults = {
        vertical: false,
        start: 1,
        offset: 1,
        size: null,
        scroll: 3,
        ...
        ...

Open in new window

0
 
gabrielPennybackAuthor Commented:
Thanks! Out of curiosity, what's the exact link of the unpacked version that you downloaded? I found a great unpacking utiility online, but the var defaults still came out in one long string. Yours has the standard js formatting, so I'm just curious ...
In any event the unpacking utility is here: http://matthewfl.com/unPacker.html
Before your last post I had no idea what packing was, so thanks!
-John
 
 
 
0
 
sosamvCommented:
the unpacked version in within the same zip file you downloaded hehe i tried making the change by myself and changing the variable scroll: 3 to scroll: 1, will only change the number of images scrolled per click :S i thought that wasnt what you wanted hehe anyway, hope you got it working, byeee
0
 
ali_pakkanCommented:
It's good to hear that everything is OK.

http://sorgalla.com/projects/jcarousel/
Download jcarousel.zip
jcarousel/lib/jquery.jcarousel.js

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 5
  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now