[jQuery] Re: When mouse over then Fade transition Pause, Please help

2009-10-16 Thread Tan


Anybody ?Please
On Oct 16, 5:32 pm, Tan it_qn2...@yahoo.com wrote:
 Hi, I have see a plugin : Fade transition plugin for jQuery
 Please see demo:http://www.robpoyntz.com/blog/?m=200905
 I want when i mouse over then Fade transition stop and when i mouse
 out then it start.

 I create a code:
 $(.container).mouseover (function() {
 $(this).stop();});

 but it's not work. Please help me.


[jQuery] Re: When mouse over then Fade transition Pause, Please help

2009-10-16 Thread Evgeny Bobovik

Try to use this code for mouse events processing

$(.container).bind(mouseenter,function(){
  Trans.pause();
}).bind(mouseleave,function(){
  Trans.pause();
});

... and replace your plugin code on this code:


(function ($) {
$.fn.fadeTransition = function(options) {
 var options = $.extend({pauseTime: 5000, transitionTime: 2000}, options);

Trans = function(obj) {
  var timer = null;
  var current = 0;
  var pause = 1;
  var els = $( *, obj).css(display, none).css(left,
0).css(top, 0).css(position, absolute);
  $(obj).css(position, relative);
  $(els[current]).css(display, block);

  function transition() {
var next = (current + 1) % els.length | 0;
$(els[current]).fadeOut(options.transitionTime);
   $(els[next]).fadeIn(options.transitionTime);
current = next;
cue();
  };

  function cue() {
if ($( *, obj).length  2) return false;
if (timer) clearTimeout(timer);

if(pause == 0){
   timer = setTimeout(cue, options.pauseTime);
}else{
  timer = setTimeout(transition, options.pauseTime);
}
  };

  pause: function(){
 if (pause == 1) pause = 0;
  else pause = 1;
  }

  cue();
};

return this.each(function() {
  var t = new Trans(this);
});
  }
})(jQuery);



code needs to be replaced because the original plug-in that you use
does not allow to stop the show, I added a feature to stop the show,
but I have not been able to verify how it works, if there are any
problems - write to me at the email bobo...@gmail.com
   Gk___




2009/10/16 Tan it_qn2...@yahoo.com:


 Anybody ?Please
 On Oct 16, 5:32 pm, Tan it_qn2...@yahoo.com wrote:
 Hi, I have see a plugin : Fade transition plugin for jQuery
 Please see demo:http://www.robpoyntz.com/blog/?m=200905
 I want when i mouse over then Fade transition stop and when i mouse
 out then it start.

 I create a code:
 $(.container).mouseover (function() {
 $(this).stop();});

 but it's not work. Please help me.


[jQuery] Re: When mouse over then Fade transition Pause, Please help

2009-10-16 Thread Tan

Hi, Evgeny Bobovik.
Thanks you .
I have modify files js to:

(function ($) {
$.fn.fadeTransition = function(options) {
 var options = $.extend({pauseTime: 5000, transitionTime: 2000},
options);

Trans = function(obj) {
  var timer = null;
  var current = 0;
  var pause = 1;
  var els = $( *, obj).css(display, none).css(left,
0).css(top, 0).css(position, absolute);
  $(obj).css(position, relative);
  $(els[current]).css(display, block);

  function transition() {
var next = (current + 1) % els.length | 0;
$(els[current]).fadeOut(options.transitionTime);
   $(els[next]).fadeIn(options.transitionTime);
current = next;
cue();
  };

  function cue() {
if ($( *, obj).length  2) return false;
if (timer) clearTimeout(timer);

if(pause == 0){
   timer = setTimeout(cue, options.pauseTime);
}else{
  timer = setTimeout(transition, options.pauseTime);
}
  };

  pause: function(){
 if (pause == 1) pause = 0;
  else pause = 1;
  }

  cue();
};

return this.each(function() {
  var t = new Trans(this);
});
  }
})(jQuery);

I create files html on host: http://cfd.net.au/learjqurery.html

But it's not work, Please help.



On Oct 16, 9:25 pm, Evgeny Bobovik bobo...@gmail.com wrote:
 Try to use this code for mouse events processing

     $(.container).bind(mouseenter,function(){
       Trans.pause();
     }).bind(mouseleave,function(){
       Trans.pause();
     });

 ... and replace your plugin code on this code:

 (function ($) {
 $.fn.fadeTransition = function(options) {
  var options = $.extend({pauseTime: 5000, transitionTime: 2000}, options);

     Trans = function(obj) {
       var timer = null;
       var current = 0;
           var pause = 1;
       var els = $( *, obj).css(display, none).css(left,
 0).css(top, 0).css(position, absolute);
       $(obj).css(position, relative);
       $(els[current]).css(display, block);

       function transition() {
         var next = (current + 1) % els.length | 0;
         $(els[current]).fadeOut(options.transitionTime);
        $(els[next]).fadeIn(options.transitionTime);
         current = next;
         cue();
       };

       function cue() {
         if ($( *, obj).length  2) return false;
         if (timer) clearTimeout(timer);

             if(pause == 0){
                timer = setTimeout(cue, options.pauseTime);
             }else{
           timer = setTimeout(transition, options.pauseTime);
             }
       };

           pause: function(){
              if (pause == 1) pause = 0;
               else pause = 1;
           }

       cue();
     };

     return this.each(function() {
       var t = new Trans(this);
     });
   }

 })(jQuery);

 code needs to be replaced because the original plug-in that you use
 does not allow to stop the show, I added a feature to stop the show,
 but I have not been able to verify how it works, if there are any
 problems - write to me at the email bobo...@gmail.com
    Gk___

 2009/10/16 Tan it_qn2...@yahoo.com:



  Anybody ?Please
  On Oct 16, 5:32 pm, Tan it_qn2...@yahoo.com wrote:
  Hi, I have see a plugin : Fade transition plugin for jQuery
  Please see demo:http://www.robpoyntz.com/blog/?m=200905
  I want when i mouse over then Fade transition stop and when i mouse
  out then it start.

  I create a code:
  $(.container).mouseover (function() {
  $(this).stop();});

  but it's not work. Please help me.