View previous topic :: View next topic
Author
Message
Shinzon Joined: 15 Jun 2008 Posts: 23
Back to top
darkqueliss Joined: 27 May 2008 Posts: 1058
Back to top
Shinzon Joined: 15 Jun 2008 Posts: 23
Posted: 31.10.2009 20:13 Post subject:
Moram priznat da ne shvaćam što si htio reći tim odgovorom?
Pa da se razumjem u JS ne bi tražio pomoć.
Back to top
darkqueliss Joined: 27 May 2008 Posts: 1058
Posted: 31.10.2009 20:19 Post subject:
Cekaj, trebas se razumijet u js da bi znao ovo rjesit?
Quote: var defaults = {
ms: 2000,
n: 1,
autoHeight: false
};
Probaj tu negdje 0 stavit il nesto, ni ja neznam napamet, istrazuj malo, probaj googlat...
Back to top
il collonelo Joined: 10 Mar 2005 Posts: 28 Location: Zagreb
Posted: 02.11.2009 00:36 Post subject:
probaj postavit setInterval u neku varijablu te na mouseover pozvat clearInterval(ime varijable)
Back to top
strija Joined: 14 Sep 2003 Posts: 473 Location: Čakovec
Posted: 02.11.2009 12:41 Post subject:
Evo na brzinu customiziran plugin sa opcijom koju trebas:
Code: /*
* jquery.rotator
* Version: 0.1
*/
(function($){ $.fn.rotator = function(options){
var defaults = {
ms: 2000,
n: 1,
autoHeight: false,
mouseOverStop: false
};
var options = $.extend(defaults, options);
var interval = false;
return this.each(function(index) {
var $this = $(this);
var initialHeight = 0;
$this.children().filter(":lt("+options.n+")").each(function(index,item){
initialHeight += $(item).height();
});
$this.height(initialHeight);
interval = setInterval(runRotator, options.ms);
if (options.mouseOverStop == true) {
$this.hover(
function() { clearInterval(interval); }
,function() { interval = setInterval(runRotator, options.ms); }
);
}
function runRotator() {
var childHeight = $this.children().filter(":first-child").height();
var animParams = {scrollTop: (childHeight) + "px"};
var autoHeight = 0;
$this.children().filter(":lt("+(options.n+1)+")").each(function(index,item){
if(index>0)autoHeight += $(item).height();
});
if(options.autoHeight)animParams = $.extend({height:(autoHeight) + "px"}, animParams);
$this.animate(animParams, 500, function(){
$this.scrollTop(0);
$this.append($this.children().filter(":first-child"));
$this.css("overflow","hidden"); //Chrome hack
});
}
});
}})(jQuery);
Samo ga pozovi na ovaj nacin:
Code: $("#rotator1").rotator({n: 3, autoHeight: true, mouseOverStop: true});
Nisam testirao u svim browserima, ali mislim da bi trebalo raditi.
_________________ We can exist in ambiguity, but it means the deepest loneliness. | creolab.hr | thefarewellreason.com
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
Powered by phpBB © 2001, 2005 phpBB Group