2010-07-08 18 views
7

पर दो अलग-अलग प्रभाव का उपयोग मैं वर्तमान में jQuery.Cycle<div> टैग का उपयोग कर रहा चक्र करने के लिए कुछ बच्चे के माध्यम से। हालांकि, मैं चाहता हूं कि डिफ़ॉल्ट चक्र fx fade हो, और जब मैं next या prev चयनकर्ताओं पर क्लिक करता हूं, तो मैं चयनकर्ता क्लिक के आधार पर चक्र fx अस्थायी रूप से scrollRight या scrollLeft पर बदलना चाहता हूं।jQuery.Cycle - एक ही कंटेनर

क्या यह संभव है?

jQuery कोड, यदि आवश्यक हो:

$('#banner_content').cycle({ 
    fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
    timeout: 6500, 
    speed: 2000, 
    next: $("#right_arrow a"), 
    prev: $("#left_arrow a"), 
}); 

उत्तर

11

ठीक है, मैं अपने प्रश्न jQuery Forum पर जोड़ा, और निर्माता निम्नलिखित answer साथ जवाब दिया।

var slideIndex = 0; 
var nextIndex = 0; 
var prevIndex = 0; 

$('#banner_content').cycle({ 
    fx: 'fade',//fx: 'scrollHorz', // choose your transition type, ex: fade, scrollUp, shuffle, etc... 
    timeout: 8000, 
    speed: 1000, 
    easingIn:20, 
    easingOut:40, 
    after: function(currSlideElement, nextSlideElement, options) { 
     slideIndex = options.currSlide; 
     nextIndex = slideIndex + 1; 
     prevIndex = slideIndex -1; 

     if (slideIndex == options.slideCount-1) { 
      nextIndex = 0; 
     } 

     if (slideIndex == 0) { 
      prevIndex = options.slideCount-1; 
     } 
    } 
}); 

$("div.left_arrow a").click(function() { 
    $('#banner_content').cycle(nextIndex, "scrollRight"); 
}); 

$("div.right_arrow a").click(function() { 
    $('#banner_content').cycle(prevIndex, "scrollLeft"); 
}); 
:

यहाँ मेरी कोड है कि मैं इस के लिए विकसित की है

संबंधित मुद्दे