вставить значение переменной в функцию
Прошу помощи уважаемые!
Есть функция (слайдер) (function($) { $.fn.lofJSidernews = function( settings ) { return this.each(function() { // get instance of the lofSiderNew. new $.lofSidernews( this, settings ); }); } $.lofSidernews = function( obj, settings ){ this.settings = { direction : '', mainItemSelector : 'li', navInnerSelector : 'ul', navSelector : 'li' , navigatorEvent : 'click', wapperSelector: '.lof-main-wapper', interval : 14000, auto : false, // whether to automatic play the slideshow maxItemDisplay : 3, startItem : 0, navPosition : 'vertical', navigatorHeight : 100, navigatorWidth : 310, duration : 600, navItemsSelector : '.lof-navigator li', navOuterSelector : '.lof-navigator-outer' , isPreloaded : true, easing : 'easeInOutQuad', mainWidth : screen.width } var li_width = $('.lof-main-outer').css("width"); alert (li_width); $.extend( this.settings, settings ||{} ); this.nextNo = null; this.previousNo = null; this.maxWidth = this.settings.mainWidth || 1072; ...... так вот внутри нее я создаю переменную li_width алертом прекрасно выводится ее значение. Проблема банальная: не могу подставить это значение вместо '1072' (в конце кода) чтоо только не пробовал уже... |
ПРОБЛЕМА РЕШЕНА!
$.lofSidernews = function( obj, settings ){ this.settings = { direction : '', mainItemSelector : 'li', navInnerSelector : 'ul', navSelector : 'li' , navigatorEvent : 'click', wapperSelector: '.lof-main-wapper', interval : 14000, auto : false, // whether to automatic play the slideshow maxItemDisplay : 3, startItem : 0, navPosition : 'vertical', navigatorHeight : 100, navigatorWidth : 310, duration : 600, navItemsSelector : '.lof-navigator li', navOuterSelector : '.lof-navigator-outer' , isPreloaded : true, easing : 'easeInOutQuad', mainWidth : screen.width } var li_width = $('.lof-main-outer').css("width"); var result = li_width.substring (0, li_width.lastIndexOf ('px')); // alert (result); $.extend( this.settings, settings ||{} ); this.nextNo = null; this.previousNo = null; // this.maxWidth = this.settings.mainWidth || result; this.maxWidth = result; ..... |
Часовой пояс GMT +3, время: 20:10. |