Monday, 15 March 2010

image - jQuery gallery hover issue -


OK, so I have this jQuery and a little CSS, which has a basic fading image gallery. I have many examples of this gallery type on my page but I want to make it so that the gallery starts only when you get it on

  $ (function () {$ ('. Banner-items: no (: first) (current:' (last- '': 'last-child')) {var next = $ ('. Banner-items: first');} and {var Fade (800);}} current; current.next ();} current. P> Here's my CSS:  
  .banner {width: 200px; height: 75px; margin: 0; padding: 0; Style: None; Status: Relative;} .banner-item {position: absolute; left: 0; top: 0;}   

Here's my HTML:

  & lt; ul class = "banner" & gt; & lt; l class = "banner-item">     

To allow it to work on several instances, you need to make sure It is necessary that you are referring to the element that is hovering over the user.

An example of using mouseover and mouseout to start and stop the carousel is carousel_next to the method Each call is essentially just another queue when the user's mouse leaves .banner div, then he resets.

  (function () {var carousel_timer = null; $ ('. Banner-item: no (:' already child) '). (). $ (' Banner '). ({'Mouseover': function () {var e = $ (this); carousel_next (e);}, 'mouseout': function () {clear timeout (carousel_time);}}) function carousel_ext (e) {var current = $ (E) .find ('banner-item: view'); if (current. This (': last-child')) {var next = $ (e) .find ('. Banner-item: first ');} Else {var next = current.next ()}} current.stop (true, true) .FadeOut (800); Next.stop (true, true). FadeIn (800); carousel_timer = setTimeout (Function () {carousel_next (e)}, 5000);}});    

No comments:

Post a Comment