选项.whatever(options.slideDirection)值对于两个容器保持相同而不是例如:slideSpeed:800 - > container1,slideSpeed:700 - > container2当populateContent()调用runSlider()但是如果直接调用runSlider则保持正确。
$('#container1').slide({
service : "services/service1.json",
slideInterval : 2000,
slideSpeed : 800,
slideDirection : 'right'
});
$('#container2').slide({
service : "services/service2.json",
slideInterval : 7000,
slideSpeed : 200,
slideDirection : 'left'
});
$.fn.slide = function(settings) {
var options = {
service : '',
slideInterval : 5000,
slideSpeed : 800,
slideDirection : 'right'
};
$.extend(options , settings);
jQuery.populateContent = function(serviceUrl,elm) {
$.runSlider(elm);
});
jQuery.runSlider = function(el) {
console.log(options.slideDirection); //***always option value remains the same, shows left always...
});
return $(this).each(function() {
var self = this;
$.populateContent(service,self); -> calls populateContent() ->runSlider() -> **Not proper option.slideDirection always remain same
//$.setSlider(self); -> directly calls runSlider() -> **It is proper** option.slideDirection change
});
});