JS筆記

2015-06-11

禁止複製和右鍵的jquery function

禁止複製和右鍵的jquery function //禁止右鍵,選取複製等等 $(window).on("contextmenu", function(e) {e.preventDefault();}) $(window).on("keydown", function(e) {if(e.keyCode == 123)e.preventDefault();}) disableSelection(document.body); //禁止選取網頁內容及複製 function disableSelection(target){  &...
更多資料
2015-03-30

JQuery IOS browser height issue

如果用JQuery $(window).height()所取得的值會是IOS的設備高,如果要正確取得高度,可以透過以下代碼: height = window.innerHeight ? window.innerHeight : $(window).height() 此問題僅出現在IOS系統下safari,其他瀏覽器是沒問題的 來源: http://bugs.jquery.com/ticket/6724 ...
更多資料
2014-12-24

JQ 控制iframe內容

可以透過JQuery用以下方法來取得iframe中的物件並控制它 $(function() { $('#abgne_iframe').load(function(){   var $iframe = $(this),   $contents = $iframe.contents();                 getContent.find("iframe中的物件").h...
更多資料
2014-12-02

JS 資源網站

JS Tutorial http://js-tutorial.com/line-control-editor-a-light-weight-html5-text-editor-660 ...
更多資料
2014-11-10

javascript 好用的自訂函式

數字前補上零的函式 function pad (str, max) {   str = str.toString();   return str.length < max ? pad("0" + str, max) : str; } 套函式方法,參數一為預調整的數字,參數二為預轉換的數字量 如: 要將數字以三個字元來呈現,則第二個參數為三,依此類推 pad("3", 3);    // => "003" pad("123", ...
更多資料
2014-10-09

jQuery 衝突解決方式

如果jquery和其他libery有出現衝突的時候,且libery又必須併存時,jquery有提供解決衝突的寫法,如下: $.noConflict(); jQuery( document ).ready(function( $ ) { // Code that uses jQuery's $ can follow here. }); // Code that uses other library's $ can follow here.   參考: http://api.jquery.com/jquery....
更多資料
2014-09-12

JS TOP 功能

http://www.scrolltotop.com/ ...
更多資料
2014-07-03

偵測flash player是否有安裝

如果文件內有flash`,且為了避免在不支援flash的設備中產生破版的問題,可以引用下列程式碼來偵測flash是否有支援,判斷以hasFlash的參數來決定是要顯示flash內容還是取代內容 var hasFlash = false;     try {       var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');       if(fo) hasFlash = true; &n...
更多資料
2013-11-08

日期的比較

將日期設定為目前日期。 當您建立 Date 物件的執行個體時,如果沒有指定日期,則會傳回表示目前日期和時間的值,包括年、月、日、小時、分鐘、秒及毫秒。 然後您可以讀取或修改這個日期和時間。 下列範例示範如何具現化日期而不使用任何參數,並以 mm-dd-yy 格式顯示。 JavaScript   var dt = new Date(); // Display the month, day, and year. getMonth() returns ...
更多資料

Contact

Github

Codepen

歡迎參觀我的賣場
© 2013 Copyright Digishot Web | Design Tools
Visitors【630306】
digishot webdesign studio