菜雞前端問題整理

CSS設置滾動條:

/*---滾動條默認顯示樣式--*/  
::-webkit-scrollbar-thumb{ 
   background-color:#77909D;  
   border-radius:6px;  
}  

/*---鼠標點擊滾動條顯示樣式--*/  
::-webkit-scrollbar-thumb:hover{  
   background-color:#5F7580;  
   border-radius:6px;  
}  
/*---滾動條大小--*/  
::-webkit-scrollbar{  
   width:6px;  
   height:6px;  
}  
/*---滾動框背景樣式--*/  
::-webkit-scrollbar-track-piece{   
   border-radius:0;  
}

jquery的$.extend()、$.fn和$.fn.extend()

jQuery.fn = jQuery.prototype = {    init: function( selector, context ) {//…. //…… };

//$.fn表示jquery的對象增長方法($("#id").test())
//給jQuery中的每一個實例加方法
$.fn.test = function () {
 alert($(this).text());
}javascript

jQuery.extend(object)

//C#中每一個對象都有本身的方法,可是也有靜態方法啊, $.extend就來了html

//加靜態方法
jQuery.extend({
max:(a,b)=> { return a>b?a:b; },
min:(a,b)=> { return a<b?a:b; },
});java

//調用 $.max(1,2)=>2jquery

Objectj Query.extend( target, object1, [objectN])

//用一個或多個其餘對象來擴展一個對象,返回被擴展的對象 web

var settings = { validate: false, limit: 5, name: "foo" };瀏覽器

var options = { validate: true, name: "bar" };函數

jQuery.extend(settings, options); post

結果:settings == { validate: true, limit: 5, name: "bar" }this

jQuery.fn.extend(object);

//對jQuery.prototype進得擴展,就是爲jQuery類添加「成員函數」。url

//jQuery類的實例能夠使用這個「成員函數」。 好比咱們要開發一個插件,作一個特殊的編輯框,當它被點擊時,便alert 當前編輯框裏的內容。能夠這麼作:

$.fn.extend({ alertWhileClick:function() {

$(this).click(function(){ alert($(this).val());

});

} });

$("#input1").alertWhileClick();

jQuery.fn.extend = jQuery.prototype.extend

你能夠拓展一個對象到jQuery的 prototype裏去,這樣的話就是插件機制了。

(function( $ ){ $.fn.tooltip = function( options ) { };

//等價於

var tooltip = { function(options){ } }; $.fn.extend(tooltip) = $.prototype.extend(tooltip) = $.fn.tooltip })( jQuery );

 //jQuery.fn.extend = jQuery.prototype.extend,目前這種方法還沒用過,因此我也不是很瞭解,理解jquery的$.extend()、$.fn和$.fn.extend(),這篇博客寫的仍是比較全的

js中的箭頭函數

(參數1, 參數2, …, 參數N) => { 函數聲明 }
(參數1, 參數2, …, 參數N) => 表達式(單一)
//至關於:(參數1, 參數2, …, 參數N) =>{ return 表達式; }

// 當只有一個參數時,圓括號是可選的:
(單一參數) => {函數聲明}
單一參數 => {函數聲明}

// 沒有參數的函數應該寫成一對圓括號。
() => {函數聲明}

 就至關於C#中的lambda實現委託的方法;可是目前箭頭函數是ES6的語法,就像let 關鍵字也是,有許多瀏覽器不兼容

 

EasyUi中Datetime控件,不能選擇指定日期先後時間

$('#planRunDt').datebox('calendar').calendar({//只能選擇先後時間
                validator: function (date) {
                    var now = new Date();
                    var d1 = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 7);
                    var d2 = new Date(now.getFullYear(), now.getMonth(), now.getDate() + 7);
                    return date >= d1 && date <= d2;
                }
            }); 

  官方文檔的提示:The validator function that is used to determine if a calendar day can be selected, return false to prevent from selecting a day. Available since version 1.3.6.。須要查看版本是否知足

相關文章
相關標籤/搜索