jQuery thumbnail scroller
A thumbnail/image scroller that can be used as standalone or alongside lightboxes, gallery scripts etc. Features include: scrolling by cursor movement, buttons and/or touch, vertical and/or horizontal scrolling, customization via CSS and option parameters, methods for triggering events like scroll-to, update, destroy etc., user-defined callbacks functions and more.
Current version 2.0.3 (Changelog) – Version 1.x.x (no longer actively maintained)
How to use it
HTML
Get plugin files. Extract and upload jquery.mThumbnailScroller.min.js and jquery.mThumbnailScroller.css to your web server (more info)
Include jquery.mThumbnailScroller.css in the head tag your html document
<link rel="stylesheet" href="/path/to/jquery.mThumbnailScroller.css">
Include jQuery library (if your project doesn’t use it already) and jquery.mThumbnailScroller.min.js in your document’s head or body tag
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="/path/to/jquery.mThumbnailScroller.min.js"></script>
Create the markup with your images, links, etc. which is basically an element (e.g. a div) holding an unordered list (ul)
<div id="my-thumbs-list"> <ul> <li><a href="image-1-link"><img src="/path/to/image-1-file" /></a></li> <li><a href="image-2-link"><img src="/path/to/image-2-file" /></a></li> <li><a href="image-3-link"><img src="/path/to/image-3-file" /></a></li> <li><a href="image-4-link"><img src="/path/to/image-4-file" /></a></li> <!-- and so on... --> </ul> </div>
CSS
Give your element (in the example above #my-thumbs-list) a width and/or height value and a CSS overflow value of auto or hidden. For example:
#my-thumbs-list{ overflow: auto; width: 800px; height: auto; }
If you’re creating a vertical scroller, you’ll need to set a height (or max-height) value
#my-thumbs-list{ overflow: auto; width: 300px; height: 500px; }
Initialization
Initialize via javascript
Create a script and call mThumbnailScroller function on your element selector along with the option parameters you want
<script> (function($){ $(window).load(function(){ $("#my-thumbs-list").mThumbnailScroller({ axis:"x" //change to "y" for vertical scroller }); }); })(jQuery); </script>
Initialize via HTML
If you prefer to initialize the plugin without a script, you can simply give your element the class mThumbnailScroller
and optionally set its orientation via the HTML data attribute data-mts-axis
("x"
for horizontal and "y"
for vertical). For example:
<div id="my-thumbs-list" class="mThumbnailScroller" data-mts-axis="x"> <ul> <!-- your content --> </ul> </div>
Basic configuration & option parameters
The 2 basic options are axis
which defines the scroller orientation and type
which defines how the user interacts with the scroller.
axis
The default scroller orientation is horizontal, so if you don’t set an axis
option value, it defaults to "x"
$("#my-thumbs-list").mThumbnailScroller({ axis:"x" });
To create a vertical scroller, set axis
option to "y"
$("#my-thumbs-list").mThumbnailScroller({ axis:"y" });
or use data-mts-axis="y"
if you’re initializing the plugin via HTML
type
You can set the type of scroller via javascript, for example:
$("#my-thumbs-list").mThumbnailScroller({ type:"hover-50" });
or using the HTML data attribute data-mts-type
, e.g.:
<div class="mThumbnailScroller" data-mts-type="hover-50">...</div>
There are 4 basic scroller types:
"hover-[number]"
(e.g."hover-33"
,"hover-80"
etc.)Scrolling content in linear mode by hovering the cursor over the scroller edges. The edges are defined by the type name, where [number] indicates the percentage of the scroller area in which scrolling is idle. For example, setting
"hover-50"
(default value) on a 600 pixels wide horizontal scroller, means that scrolling will be triggered only when the cursor is over the first 150 pixels from the left or right edge. And when cursor is over the 50% of the scroller width (300 pixels), scrolling will be idle or stopped.hover-precise
Scrolling content with animation easing (non-linear mode) by hovering the cursor over the scroller. The scrolling speed and direction is directly affected by the cursor movement and position within the scroller.
"click-[number]"
(e.g."click-50"
,"click-90"
etc.)Scrolling content by clicking buttons. The scrolling amount is defined by type name, where [number] indicates a percentage of the scroller area. For example, setting
"click-50"
on a 800 pixels wide horizontal scroller, means that each time you click the left or right arrow buttons, the content will scroll by 400 pixels (50% of 800px) to the left or right.click-thumb
Scrolling each image/thumbnail at a time by clicking buttons.
"hover-[number]"
and hover-precise
types become disabled on touch-enabled devices and replaced by content touch-swipe scrolling.
Configuration
You can configure your scroller(s) using the following option parameters when calling mThumbnailScroller function
Usage $(selector).mThumbnailScroller({ option: value });
setWidth: false
- Set the width of the scroller (overwrites CSS width), value in pixels (integer) or percentage (string).
setHeight: false
- Set the height of the scroller (overwrites CSS height), value in pixels (integer) or percentage (string).
setTop: 0
- Set the initial css top property of content, accepts string values (css top position).
Example:setTop: "-100px"
.
setLeft: 0
- Set the initial css left property of content, accepts string values (css left position).
Example:setLeft: "-100px"
.
type: "string"
- Scroller type defines the way users interact with the scroller.
Available values:"hover-[number]"
(e.g."hover-50"
)
Scrolling content in linear mode by hovering the cursor over the scroller edges. The edges are defined by the type name, where [number] indicates the percentage of the scroller area in which scrolling is idle. Scrolling accelerates proportionally according to cursor position: e.g. scrolling speed increases as the cursor moves towards the edges and decreases as it moves towards the center of the scroller area."hover-precise"
Scrolling content with animation easing (non-linear mode) by hovering the cursor over the scroller. The scrolling speed and direction is directly affected by the cursor movement and position within the scroller.click-[number]
(e.g."click-80"
)
Scrolling content by clicking buttons. The scrolling amount is defined by type name, where [number] indicates a percentage of the scroller area."click-thumb"
Scrolling each image/thumbnail at a time by clicking buttons. Each click will scroll the content by the width/height of the next non-visible adjusted image.
axis: "string"
- Define scroller axis (scrolling orientation).
Available values:"y"
,"x"
,"yx"
.axis: "y"
– vertical scrolleraxis: "x"
– horizontal scroller (default)axis: "yx"
– vertical and horizontal scroller (useful when panning images or switching axis on-the-fly)
speed: integer
- Set the scrolling speed (higher=faster). Default value is
15
.
contentTouchScroll: integer
- Enable or disable content touch-swipe scrolling for touch-enabled devices.
To completely disable, setcontentTouchScroll: false
. Integer values define the axis-specific minimum amount required for scrolling momentum (default value is25
).
markup:{ thumbnailsContainer: "string" }
- Set the element containing your thumbnails. By default, this is an unordered list (
ul
).
markup:{ thumbnailContainer: "string" }
- Set the element containing each thumbnail. By default this is a list-item (
li
).
markup:{ thumbnailElement: "string" }
- Set the actual thumbnail element. By default, this is an image tag (
img
).
advanced:{ autoExpandHorizontalScroll: boolean }
- Auto-expand content horizontally (for
"x"
or"yx"
axis).
If set totrue
(default), content will expand horizontally to accomodate any floated/inline-block elements (such asli
,a
,img
etc.).
advanced:{ updateOnContentResize: boolean }
- Update scroller(s) automatically on content, element or viewport resize. The value should be
true
(default) for fluid layouts/elements, adding/removing content dynamically, hiding/showing elements etc.
advanced:{ updateOnImageLoad: boolean }
- Update scroller(s) automatically each time an image inside the element is fully loaded. The value is
true
by default.
advanced:{ updateOnSelectorChange: "string" }
- Update scroller(s) automatically when the amount and size of specific selectors changes.
Useful when you need to update the scroller(s) automatically, each time a type of element is added, removed or changes its size.
For example, settingupdateOnSelectorChange: "ul li"
will update the scroller each time list-items inside the element are changed. Setting the value totrue
, will update the scroller each time any element is changed. To disable (default) set tofalse
.
theme: "string"
- Set a ready-to-use scroller theme (plugin’s CSS contains all themes).
callbacks:{ onInit: function(){} }
- A function/custom code to execute when the scroller has initialized (callbacks demo).
Example:
callbacks:{ onInit:function(){ console.log("scroller initialized"); } }
callbacks:{ onScrollStart: function(){} }
- A function/custom code to execute when scrolling starts (callbacks demo).
Example:
callbacks:{ onScrollStart:function(){ console.log("scroll started"); } }
callbacks:{ onScroll: function(){} }
- A function/custom code to execute when scrolling is completed (callbacks demo).
Example:
callbacks:{ onScroll:function(){ console.log("scroll completed"); } }
callbacks:{ onTotalScroll: function(){} }
- A function/custom code to execute when scrolling is completed and content is scrolled all the way to the end (bottom and/or right) (callbacks demo).
Example:
callbacks:{ onTotalScroll:function(){ console.log("Scrolled to 100%"); } }
callbacks:{ onTotalScrollBack: function(){} }
- A function/custom code to execute when scrolling is completed and content is scrolled back to the beginning (top and/or left) (callbacks demo).
Example:
callbacks:{ onTotalScrollBack:function(){ console.log("Scrolled back to 0%"); } }
callbacks:{ onTotalScrollOffset: integer }
- Set an offset for the onTotalScroll callback option.
For example, settingonTotalScrollOffset: 100
will trigger the onTotalScroll callback 100 pixels before the end of scrolling is reached.
callbacks:{ onTotalScrollBackOffset: integer }
- Set an offset for the onTotalScrollBack callback option.
For example, settingonTotalScrollBackOffset: 100
will trigger the onTotalScrollBack callback 100 pixels before the beginning of scrolling is reached.
callbacks:{ whileScrolling: function(){} }
- A function/custom code to execute while scrolling is active (callbacks demo).
Example:
callbacks:{ whileScrolling:function(){ console.log("scrolling..."); } }
callbacks:{ alwaysTriggerOffsets: boolean }
- Control the way onTotalScroll and onTotalScrollBack offsets execute.
By default, callback offsets will trigger repeatedly while content is scrolling within the offsets.
SetalwaysTriggerOffsets: false
when you need to trigger onTotalScroll and onTotalScrollBack callbacks only once.
live: boolean, "string"
- Enable or disable the creation of scroller(s) on all elements matching the current selector, now and in the future.
Setlive: true
when you need to add scroller(s) on elements that do not yet exist in the page. These could be elements added by other scripts or plugins after some action by the user.
If you need at any time to disable or enable the live option, setlive: "off"
and"on"
respectively.
You can also tell the script to disable live option after the first invocation by settinglive: "once"
.
liveSelector: "string"
- Set the matching set of elements to apply a scroller, now and in the future.
Plugin methods
Methods are ways to execute various scroller actions programmatically from within your script(s).
update
Usage $(selector).mThumbnailScroller("update");
Call the update method to manually update existing scrollers to accomodate new content or resized element(s). This method is by default called automatically by the script (via updateOnContentResize
option) when the element itself and/or its content size changes.
scrollTo
Usage $(selector).mThumbnailScroller("scrollTo", position, {options});
Call the scrollTo method to scroll content to the position parameter. Position parameter can be a string (e.g. "#element-id"
, "bottom"
, "left"
etc.), an integer indicating number of pixels (e.g. 100
), an array for y/x axis (e.g. [100,100]
), a js/jQuery object, a function etc. method demo
scrollTo position parameter
Position parameter can be:
"string"
- Element selector
For example, scroll to element with id “element-id”:
$(selector).mThumbnailScroller("scrollTo","#element-id");
- Special pre-defined position
For example, scroll to right:
$(selector).mThumbnailScroller("scrollTo","right");
Pre-defined position strings:
"bottom"
– scroll to bottom"top"
– scroll to top"right"
– scroll to right"left"
– scroll to left"first"
– scroll to the position of the first element within content"last"
– scroll to the position of the last element within content
- Number of pixels less/more: (e.g.
"-=100"
/"+=100"
)
For example, scroll by 100 pixels right:
$(selector).mThumbnailScroller("scrollTo","-=100");
- Element selector
integer
- Number of pixels (from left and/or top)
For example, scroll to 100 pixels:
$(selector).mThumbnailScroller("scrollTo",100);
- Number of pixels (from left and/or top)
[array]
- Different y/x position
For example, scroll to 100 pixels from top and 50 pixels from left:
$(selector).mThumbnailScroller("scrollTo",[100,50]);
- Different y/x position
object/function
- jQuery object
For example, scroll to element with id “element-id”:
$(selector).mThumbnailScroller("scrollTo",$("#element-id"));
- js object
For example, scroll to element with id “element-id”:
$(selector).mThumbnailScroller("scrollTo",document.getelementbyid("element-id"));
- function
For example, scroll to 100 pixels:
$(selector).mThumbnailScroller("scrollTo",function(){ return 100 });
- jQuery object
scrollTo method options
speed: integer
- Scrolling speed.
Example:
$(selector).mThumbnailScroller("scrollTo", "-=200", { speed: 30 });
duration: integer
- Scrolling animation duration, value in milliseconds.
Example:
$(selector).mThumbnailScroller("scrollTo", "right", { duration: 1000 });
easing: "string"
- Scrolling animation easing, values:
"easeInOut"
"easeOut"
"easeInOutSmooth"
"easeOutSmooth"
"easeInOutStrong"
"easeOutStrong"
"easeInOut"
"easeInOut"
Example:
$(selector).mThumbnailScroller("scrollTo", 300, { easing: "easeOutSmooth" });
callbacks: boolean
- Trigger user defined callbacks after scroll-to event is completed, values:
true
,false
.
Example:
$(selector).mThumbnailScroller("scrollTo", "top", { callbacks: false });
timeout: integer
- Method timeout (delay). The default timeout is 60 (milliseconds) in order to work with automatic scroller update functionality, value in milliseconds.
Example:
$(selector).mThumbnailScroller("scrollTo", "last", { timeout: 0 //no timeout });
stop
Usage $(selector).mThumbnailScroller("stop");
Stops running scrolling animations. Usefull when you wish to interrupt a previously scrollTo call.
disable
Usage $(selector).mThumbnailScroller("disable");
Calling disable method will temporarily disable the scroller(s). Disabled scrollers can be re-enabled by calling the update method.
To disable a scroller and reset its content position, call the method by setting its reset parameter to true
:
$(selector).mThumbnailScroller("disable", true);
destroy
Usage $(selector).mThumbnailScroller("destroy");
Calling destroy method will completely remove the scroller and return the element to its original state.
Scroller styling & themes
You can style your scroller(s) using jquery.mThumbnailScroller.css which contains the basic/default styling and few ready-to-use themes.
You can modify the default styling or an existing scroller theme directly, clone a theme and change it to your needs or overwrite the CSS in another stylesheet. If you wish to maintain compatibility with future plugin versions (that may include an updated version of jquery.mThumbnailScroller.css), I recommend using your own custom (or cloned) theme (creating your own custom theme), or overwriting the CSS. This way you can always upgrade jquery.mThumbnailScroller.css without having to redo your changes.
Themes
Plugin’s CSS includes a number of ready-to-use themes for quickly applying a basic styling to your scroller(s). To apply a theme, use theme
option parameter:
$(selector).mThumbnailScroller({ theme: "theme-name" });
or the HTML data attribute data-mts-theme
in your markup:
<div class="mThumbnailScroller" data-mts-theme="theme-name">...</div>
creating your own custom theme
User-defined callbacks
You can trigger your own js function(s) by using plugin’s callbacks option parameter (see all availbale callbacks in configuration section). Some examples:
$(selector).mThumbnailScroller({ callbacks:{ onScroll: function(){ /* do something */ } } });
$(selector).mThumbnailScroller({ callbacks:{ onTotalScroll: function(){ myFunction(); } } }); function myFunction(){ /* do something */ }
The plugin returns a number of values and objects that can be used inside the callbacks
this
– the scroller elementthis.mts.content
– the scrollable element containing the content (e.g. theul
element) as jquery objectthis.mts.top
– content’s top position (pixels)this.mts.left
– content’s left position (pixels)this.mts.topPct
– content vertical scrolling percentagethis.mts.leftPct
– content horizontal scrolling percentagethis.mts.direction
– content’s scrolling direction (returns"x"
or"y"
)
Plugin dependencies & requirements
- jQuery version 1.6.0 or higher
License
This work is released under the MIT License.
You are free to use, study, improve and modify it wherever and however you like.
https://opensource.org/licenses/MIT
Donating helps greatly in developing and updating free software and running this blog 🙂
Hi there Malihu,
I am using this incredible plugin, which is AWESOME!
But I have a little problem, I want to use multiple thumbnail scrollers on my website and the first one works great, but the others just display the first 4 images and it can’t be scrolled! I have checked the code and its perfect, I even copied the javascript source for each scroller and it doesn’t works!
I would appreciate your help and congratulate you for this great plugin!
So cool . Thanks .
Hey there!
I have tried out this scroller on my site and having the same issues as some others here. Sometimes the scroller (horizontal) only loads a few images instead of the much more I have in the code. I have managed to figure out that in these problematical cases the width of jTscrollerContainer is not set correctly. I would be grateful if you would share your ideas why this happens.
Thanks in advance.
I’m noticing a “jitter” at the far right using Firefox and IE (Safari seems ok). I see your demo here also does it so I’m wondering if there’s a known fix for this?
What happens is when the thumbnails get all the way to the right, instead of stopping on the last thumb it jitters back and forth. Any help would be GREATLY appreciated!
Thank you so much for such a great script. I have a question – is it possible to be able to scroll to the end (the right) and then it loops back around to the beginning?
I’m noticing a “jitter” at the far right using Firefox and IE (Safari seems ok). I see your demo here also does it so I’m wondering if there’s a known fix for this?
What happens is when the thumbnails get all the way to the right, instead of stopping on the last thumb it jitters back and forth. Any help would be GREATLY appreciated!
Does this happen on “hoverAccelerate” mode? That jitter happens once or?
Hey there,
Thank you so much for such a great script. I have a question – is it possible to be able to scroll to the end (the right) and then it loops back around to the beginning?
Kind Regards
Hello,
Nope. This particular plugin cannot behave as carousel with those types of scrolling, as it interacts mostly with the cursor position over it.
No problem, I understand.
Thanks for such great work.
Regards
Hi, that scroller is great, but I have problems with it under Opera 11.50 .
http://unifire.biuro.evillage.pl/node/3 – do You have any ideas, what to do about this problem? Navigation scrolls just link to top of the page and are always displayed. And, what’s bigger problem – it’s not scrolling.
Hi guys, I have had my site up for a while and i’m noticing an intermittent problem with the script, check out http://www.sodesigns.co.uk, it may happen it may not, but basically, when I scroll to the left all the images scroll too far off the page.
It’s as if the Stop function is not working properly. I had a developer do this for me initially, and have no clue on how to fix this, but i’m hoping it won’t be that hard and it’s something i can do myself.
Help!!!
This scroller is working better than I expected.
I have included more than 15 thumbnail scollers on my website (integrated into wordpress) and its performance is flawless crossbrowser. I have to added some if else statements to set the “click buttons” in case of mobile devices. But other than that: thank you very much for creating and supporting this plugin.
Suggestion: set the height() and width: auto; for the images in jquery based on a thumb size, else IE7 will render it incorrectly.
Take a look: richardbakker.com
This scroller is really smooth!
I am having trouble getting IE7 to render properly. The scroller doesn’t start flush left to the container and then doesn’t scroll all the way to the right, so there are thumbnails that aren’t seen. I see the above suggestion, “set the height() and width: auto; for the images in jquery” but am not sure where to implement it.
Implementing the suggestions of @Russell Hepworth (http://manos.malihu.gr/jquery-thumbnail-scroller#comment-7505) @globulenann (http://manos.malihu.gr/jquery-thumbnail-scroller#comment-6080) did the trick for me!
I changed .jTscrollerContainer to position:relative instead of absolute and added to the total width via: var totalWidth=$scroller.outerWidth(true)+60; in jquery.thumbnailScroller.js.
Thanks everyone!
Having a bit of trouble loading the plugin… I’m trying to integrate it with a Nivo Slider with thumbnails generated by WordPress via timthumb… everything looks fine from what I can tell but it just doesn’t seem to be working at all. There are a few extra classes in there but the structure of the html side of things looks fine but the script doesn’t appear to be working at all. Anybody had any luck getting anything like what I’m trying to do to work?
http://www.jolieanddeen.com.au/collections/spring2011 <— here's the page I'm working on… there are 20 thumbnails there, 4 of which are hidden…
If anyone could have a look at let me know if they can see anything obviously wrong I would be eternally thankful. I've just about thrown my computer at the wall trying to work this one out myself!
hi malihu,if I put only one image in div,the div’s width is more than that image’s width ,and if I move mouse over div,the image followed mouse pos,I hope if all images’ width less than div width,they don’t move under mouse cursor.
I’m trying to reformat my photography site which is currently in Flash into an HTML 5 version. I’m trying to implement your thumb scroller but not having any luck despite almost copying and pasting the code and examples from above.
The problem is, although the bar with the thumbnails appears, the next previous buttons don’t (they do exist and are correctly referenced). Even if I chose one of the hover methods the thumbnails don’t move.
Any ideas?
You can see the page with the scroller here:
http://importedlight.com/v3/show.php?a=17
Suspect my previous problem might have been something to do with the CSS as its “sort of” working now.
Ok – new problem!
The very last image in my thumbnails seems to insist on wrapping onto the next line. This means if you use the Prev/Next buttons it looks okay but you never see the last image as its hidden below. If you use the hover-scroll options then the whole row scrolls up if you move the mouse down and you can see the final wrapped image right at the left.
Example – Next/Prev buttons
http://importedlight.com/v3/show.php?a=15
Example – Hover Scroll
http://importedlight.com/v3/show2.php?a=15
Thanks you, i am using now my web site. Programing a new time. Simple and wonderful scroller! Thanks you..
This is a GREAT tool! Thank you!! I have a really quick question as I’m having trouble integrating the horizontal scroller in my map buble views. You can see an example at:
http://www-olga.classicizingchicago.northwestern.edu/search/localsolr/chicago
Click on the Art Institute of Chicago pin to see what I’m trying to do.
As this is a Drupal site I had to make some changes to the method (i.e. replace $ with jQuery) and also modify the call to it as well:
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery(“#tS2”).thumbnailScroller({ //OLD WAY: $(“#tS2″).thumbnailScroller({
scrollerType:”clickButtons”,
scrollerOrientation:”horizontal”,
scrollSpeed:2,
scrollEasing:”easeOutCirc”,
scrollEasingAmount:600,
acceleration:4,
scrollSpeed:800,
noScrollCenterSpace:10,
autoScrolling:0,
autoScrollingSpeed:2000,
autoScrollingEasing:”easeInOutQuad”,
autoScrollingDelay:500
});
});
The issue I am running into is that the scroller works only if I have an alert on the page before the load of the bubbles. I tried placing the above call at the very bottom of my html (right before the closing tag) but that wouldn’t work.
Any help would be greatly appreciated! Either way, great sleek design and awesome work on the thumbnail scroller!
Hi,
Instead on document ready, try to call thumbnail scroller function on window load. Change:
jQuery(document).ready(function(){ ...
to:
jQuery(window).load(function(){
hanks a bunch malihu! I tried that (right before the end of and also within the map bubble code to see if either would work, but unfortunately I get the same results.
Here is the URL :
http://www.classicizingchicago.northwestern.edu/search/localsolr/chicago
I think it may have to do with the load of the bubble itself. If you have any other recommendations, please let me know. I’ll dig more.
Any body having the issue with google crome that if your scroll works some times and sometimes not.
try using the malihu suggestion.
Instead on document ready, try to call thumbnail scroller function on window load. Change:
jQuery(document).ready(function(){ …
to:
jQuery(window).load(function(){
I am trying to implement multiple scrollers on 1 page. Some scollers contain 4 images and others contain 20. Strange things happen when there are only 4 images in the scroller (I am using 100% width). Does the scroller check if the totalwidth of all thumbs is smaller then the width of the window ? if yes, it should not perform any scolling, if no, start scroll.
Now it will starts following my mouse in reverse when there are not too many thumbs.
My mistake, this was due to the height to which it validated true.
I want to add some text under each image, how can I do that?
thanks.
$(‘#tS1’).bind(‘click’,function(){
$this.remove();
$(‘#tS1’).hide();
});
I put this inside the function, I want to make it once I click a items on the horizontal bar, then the whole bar will hide and the other under the bar will show up, how to make it? thanks.
please ignore this…i have solved this already. thanks.
Hi,
1st
I use the script to link between pages, and when the page has loaded it scrolls back to the first thumbnail. Can I somehow tell the script to go to the currently selected thumbnail?
I have a class to change the background of the thumbnail (they are transparent PNGs), do you think I could use that class?
2nd
Is it possible to move the arrows outside the scroll area to keep them from blocking the thumbnails underneath?
Great script! Thanks.
Just a quick question: would there be a way to modify the script so that when “scrollerType” is set to “clickButtons” it scrolls a single image width, rather than the view width?
Hi Malihu,
Fantastic plugin!! Thanks.
Im trying to do a simple change, but getting some dificulties. I want to show the arrow not on top of the thumbs, i want them to on the Right and Left of the Thumbs. I tried to change the Right and Left css properties to negative but has the div has the overflow propertie set to hidden, just dissapears. Any idea how this can be done?
Once again, thanks for the great work!!
Best regars
Bruno Fernandes
Hi,
On demo 5 (http://manos.malihu.gr/tuts/jquery_thumbnail_scroller_multiple.html) there’s a horizontal scroller (#tS2) with next/previous arrow buttons. You can see the buttons styling on the css included in the download archive (http://manos.malihu.gr/tuts/jquery.thumbnailScroller.css). You can also check any of the elements with Firebug (Firefox) or any other browser developer tools.
Hi Malihu,
Great job !
A question/issue with autoscrolling: I’d like the slideshow to start and scroll automatically if people does not click on the arrow.
I set
autoScrolling:5,
autoScrollingSpeed:2000,
autoScrollingEasing:”easeInOutQuad”,
autoScrollingDelay:10
Is it an issue on Firefox ???
Thanks
It should work and it works well on Firefox 4 without any issues. What’s your version?
Hello malihu,
Indeed, thanks for a very smooth scroller. I am trying to make a gallery for my mother, and am having the about same situation as Vikki Neal above ( http://manos.malihu.gr/jquery-thumbnail-scroller#comment-5075 ). I want to be able to click a thumbnail and have a larger image open in an empty DIV to the right of the scroller.
You gave her some code and I tried applying that inside the script in the HTML where I thought it would go, but since I am new to jquery/javascript (this gallery for my mother is my first project) I probably didn’t put it where it belongs. (I did nest the thumbnails inside a , create the empty div with the proper #, but that did not help.)
Do you think that you could give me some indications of how to integrate the code you gave her into your latest version of the scroller?
I would be very greatful!
Thanks,
/Pierre.
Hi,
The code I posted on the previous comment is for a slightly older version of the plugin and was based on Vikki’s markup. Basically, if you’ve used the latest version, you should add something like this inside (or not) jquery.thumbnailScroller.js:
$(".jTscroller a").click(function(event) { event.preventDefault(); var $this=$(this); var image = $this.attr("href"); $("#your_image_placeholder_id img").attr("src",image); });
Change the “your_image_placeholder_id” with your element id and place inside it an empty img tag (e.g. <img src=”” />). Of course you need to have the image url you wanna load inside each thumbnail anchor href attribute.
This is the absolute minimum code to load new images without any preloaders, selected thumbnail indicators etc.
Hope I helped 🙂
Thanks a lot Manos, and for your quick reply as well.
I had to move around the script-snippet a few times in order to get it in the right place inside the .js, but now it works and I just have to play with the CSS to position everything. Then it will be a jQuery tutorial-project for me to try to add preloader and thumbnail indicators on my own.
Have a nice day!
hi malihu,
please open http://www.chrisbunjamin.com/commercial.php with mozilla firefox and see one of thumnail images become whiter than the other (the real image is not whiter like that). how to fix it? but theres no problem in internet explorer
thank you
the image i mean is the second thumbnail in http://www.chrisbunjamin.com/commercial.php where the photo have wallpaper “LOW”. it become whiter in mozilla firefox. is there anything i can do with css or what do u suggest for this?
thanks a lot
Hi there,
Thank you for sharing your work with all of us! Its really good!
I want to ask something about this script.. And the question is:
Is there a way to start the scrolling queue from a particular image? For example I want the first image on the left to be the 4th image in the list:
//visible
//visible
//hiden
//hiden
Thanks! : )
Kris
ughh : ) sorry for the empty spaces.. it was some html example : )
the ide is:
a> img1 img 2 img3 img 4 img 5 img 6 img 7 img 8 img 9</a
Hi Kris,
You can alter the left or top values of .container div in jquery.thumbnailScroller.css. A negative value (e.g. left:-300px) would initially set the scroller to start with the thumbnail at 300 pixels.
That is OK, but if I want it to start from a particular image then what? And if I have images with a different width? : ) The question is – is there an easy way to tell the script to start from an element. I want to use your script in an image gallery which will load all the images from a db. When you click on a thumbnail the page will reload showing a big view of this thumb and the rest of thumbnails starting with the shown image..
If the image I speak about is number 4 in the sequence then the scroll should start with it, and if you want to see the previous images you should scroll left then.
Did you get me now?
I see. There’s not an “easy way” of accomplishing this. Not without adding some extra function(s) to the script, because you would need to find the index number of the starting image, calculate its left position and set its negative value as the css left property of the scroller with js.
*Sorry, replied to someone else’s post rather than posting a new comment*
Hi there, thanks for the plugin.
I’ve slightly amended it so that when a thumbnail is clicked, it loads the linked image into an empty div on the page. Now I’m amazed to have been able to acheive that as I’m a rookie.
One thing that you might be able to help with however, I want to be able to highlight the clicked thumbnail and then remove that highlight and add it to the next once clicked.
My code is here – but it doesn’t seem to work 🙁
Any ideas?
var $j = jQuery.noConflict(); $j(document).ready(function(){ $j("ul#thumbnailImages li a").click(function(event) { event.preventDefault(); var image = $j(this).attr('href'); $j("#largeImage img").attr('src',image); }); }); $(function(){ $('ul#thumbnailImages li a').click(function(){ $('ul#thumbnailImages li a').removeClass("activeThumbnail"); $(this).addClass("activeThumbnail"); }); });
Hello,
Just by looking at it, you should probably write a single function like this:
$j("ul#thumbnailImages li a").click(function(event) { event.preventDefault(); var image = $j(this).attr('href'); $j("#largeImage img").attr('src',image); $j('ul#thumbnailImages li a').removeClass("activeThumbnail"); $j(this).addClass("activeThumbnail"); });
Hi thanks for the reply – i’ve sort of scraped together a similar conclusion – although your version is neater. Thanks!
hey dude, thanks for sharing this…
but I have to use more than one horizontal scroller in a page, when I use 3-4 same scroller in a page just one of them works correctly.
how can I fix this problem ? is a bug between keyboard and my chair (!!) or bug is because of your codes 😀 ?!!?
hi again !
dear master! I found the problem !!! the bug was between the keyboard and chair !! it dose fix just bye and operation in selector part !! like that $(“#tS2 , #tS6 , #tS8”) !!
thanks a alot
Wow! I’ve been looking for this! Thank you so much for this plugin.
I integrated it to my small blog powered by ModX CMSNeilYamit.com. And with a little CSS tweak, I was able to add a caption on the image.
Great stuff.
Hi there, thanks for the plugin.
I’ve slightly amended it so that when a thumbnail is clicked, it loads the linked image into an empty div on the page. Now I’m amazed to have been able to acheive that as I’m a rookie.
One thing that you might be able to help with however, I want to be able to highlight the clicked thumbnail and then remove that highlight and add it to the next once clicked.
My code is here – but it doesn’t seem to work 🙁
Any ideas?
var $j = jQuery.noConflict(); $j(document).ready(function(){ $j("ul#thumbnailImages li a").click(function(event) { event.preventDefault(); var image = $j(this).attr('href'); $j("#largeImage img").attr('src',image); }); }); $(function(){ $('ul#thumbnailImages li a').click(function(){ $('ul#thumbnailImages li a').removeClass("activeThumbnail"); $(this).addClass("activeThumbnail"); }); });
I want to use this with short, one-word captions underneath the thumbnail. Can you save me some time and tell me which CSS element(s) need to be modified?
Hey. This is a very good work man!
But can I have a question? 🙂
Is this possible to scroll while not all of the thumbnails are loaded?
Yes but you’d have to set a width/height value for the thumbnails (as html attributes or css properties) in order for the script to calculate scroller width or height correctly.
the script is sooo nice. i have a problem.. i need it to keep scrolling even after user has passed the mouse over.
any comment?
Oscar, this seems like a retarded suggestion, but have you tried turning the auto scroll off?
Malihu, there are a few small bugs in IE one I mentioned above but not in detail:
1. Thumbnail scroller jumps up and down with the cursor, can be fixed by setting top:0!important… but kinda ghetto way of doing it
also Ie doesnt deal well with opacity so ie 7
*:first-child+html ul li{filter:alpha(opacity=65);}
😛
Awesome Vlad!
Thanks for taking the time to test and post the css for ie7 🙂
PS. Funny how ie7 needs !important for top:0… go figure 😛
IE 7 should have been retired along with IE 6 a long time ago. I think we are up to 9 now?
But oh well. Another good trick if you wanna get your IE’s all in one shot is
<!--[if IE]>-->
For those who want to make it more specific, http://www.webdevout.net/css-hacks has great hacks.
Thanks again for making the auto scroller, and the redesign is really good. I like the custom font, I didn’t know google made those, I generally used font squirrel to custom make mine.
LOL it blocked my trick! hahaha
it was
(!–[if IE])
(link rel=”stylesheet” href=”http://moragodpublishing.com/files/ie.css” type=”text/css”)
(![endif]–)
but with the “” instead of “(” “)”