星期四, 10月 29, 2015

Youtube 讓iframe有透明度

記錄一下在做youtube iframe滿版時遇到元素被遮住的問題,
可以加wmode=transparent 字串到Video的URL後面即可。
遇到IE瀏覽器記得要下meta讓IE執行edge模式

Add this in your html:
http-equiv="X-UA-Compatible" content="IE=edge" />
The page in IE is rendering in Quirk mode.

Try using Youtubes iframe embed method (if thats not what you are already doing, and add: ?wmode=transparent to the url (replace ? with & if it is not the first url variable)

[UI-Bootstrap] 讓0.12.1版的popup value支援html


如果為了讓popover的支援顯示html語法,可以自行手動新增這個directive。


記錄一下google後的記錄~~

代碼如下:

備註: 0.13版似乎已被merge進主幹了

/*新增一個ui.bootstrap.popover*/
angular.module( 'ui.bootstrap.popover' )
.directive( 'popoverHtmlUnsafePopup', function () {
    return {
        restrict: 'EA',
        replace: true,
        scope: { title: '@', content: '@', placement: '@', animation: '&', isOpen: '&' },
        template: '

' }; }) .directive( 'popoverHtmlUnsafe', [ '$tooltip', function ( $tooltip ) { return $tooltip('popoverHtmlUnsafe', 'popover', 'click' ); }]);

其他用法:

1. 另外在往後的版本還有新增popover-is-open,可以提供更多彈性的控制
Starting with the 0.13.4 release, we've added the ability to programmatically control when your tooltip/popover is open or closed via the tooltip-is-open or popover-is-open attributes.

2. popover-trigger="mouseenter" 提供mouse觸發顯示

3. 手機顯示時,讓popover只維持一個關掉的方法

 angular.element(document.body).bind('click', function (e) {
         logger.debug('body click from ng');
         //Find all elements with the popover attribute
         var popups = document.querySelectorAll('*[popover]');

         if (popups) {
             //Go through all of them
             for (var i = 0; i < popups.length; i++) {
                 //The following is the popover DOM elemet
                 var popup = popups[i];
                 //The following is the same jQuery lite element
                 var popupElement = angular.element(popup);

                 var content;
                 var arrow;
                 if (popupElement.next()) {
                     //The following is the content child in the popovers first sibling
                     content = popupElement.next()[0].querySelector('.popover-content');
                     //The following is the arrow child in the popovers first sibling
                     arrow = popupElement.next()[0].querySelector('.arrow');
                 }
                 //If the following condition is met, then the click does not correspond
                 //to a click on the current popover in the loop or its content.
                 //So, we can safely remove the current popover's content and set the
                 //scope property of the popover
                 if (popup != e.target && e.target != content && e.target != arrow) {
                     if (popupElement.next().hasClass('popover')) {
                         //Remove the popover content
                         popupElement.next().remove();
                         //Set the scope to reflect this
                         popupElement.scope().tt_isOpen = false;
                     }
                 }
             }
         }
     });

參考:

    

http://stackoverflow.com/questions/11703093/how-to-dismiss-a-twitter-bootstrap-popover-by-clicking-outside

https://jsfiddle.net/mattdlockyer/C5GBU/2/

http://mattlockyer.com/2013/04/08/close-a-twitter-bootstrap-popover-when-clicking-outside/

http://stackoverflow.com/questions/23048990/can-bootstrap-tooltips-be-turned-off-based-on-device-screen-size

http://plnkr.co/edit/fhsy4V?p=preview

https://github.com/angular-ui/bootstrap/issues/618

http://stackoverflow.com/questions/31770019/angular-ui-bootstrap-popover-how-add-a-close-button




星期二, 10月 20, 2015

[Java] log4j 的設定檔配置筆記

先前有筆記一下如何設定log4j,這篇只要蒐集一些有關log4j.xml的一些工作手寫:D


  • log4j.xml 的優先權會大於 log4j.properties
  • log4j.jar不要放在每個application中
  • Web專案的話log4j.xml 的檔案路徑請放在 WEB-INF/classes/之下
  • Java專案的話可以建一個resoucrce資料夾,並把log4j.xml放在之下
  • 或著自行指定路徑,再利用DOMConfigurator.configure去讀取ex: DOMConfigurator.configure(log4jConfigurationFilename);

參考
http://wiki.apache.org/logging-log4j/Log4jConfigurationHelp

星期六, 10月 17, 2015

[Android] 解決SearchView發生 API版本錯誤

今天在使用SearchView時,
發生elicpse會發生View requires API Level11 (current min is 7): 錯誤

只要


Right click on the project folder > Android tools > Clear Link Markers 就可以解決啦


星期五, 10月 16, 2015

[Anroid] EditText onTextChanged 低級錯誤 infini loop

很腦的bug,記錄一下,不小心造成onTextChanged無窮執行,
起因在於更新UI Text時,又call了一下setText的函數,因為onTextChanged觸發時,Text已在UI變更,不應再使用setText

星期一, 10月 05, 2015

[GoogleMap] 如何動態載入Googlemap API

最近試著使用google map的離線api,目前google可以找到不同版本的,目前測試是3.8.2。
如果是在頁面直接透過script標籤引入mapapi.js是沒什麼大問題的!!

不過由於要實作讓使用者切換線上與離線地圖就發現了很扯的bug,
記錄以下失敗的方法,有需要的朋友可以參考。

嘗試失敗的方法

使用document.write,整個瀏覽器白畫面,無法使用且google map無法完全載入


                     var jsTag = '<' + 'script src="http://localhost:8080/js/libs/offlinemap/google/mapapi.js"' +
                        ' type="text/javascript"><' + '/script>';
                document.write(jsTag);


使用document.createElement的方法,console會噴以下這個錯誤 
Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.


   var element = document.createElement("script");
                element.src = "js/libs/offlinemap/google/mapapi.js";
                element.type = "text/javascript";
                document.getElementsByTagName("head")[0].appendChild(element);

成功的方法

其他你感興趣的文章

Related Posts with Thumbnails