2014-11-03 11 views
0

有沒有人知道一種方法來使'fa-image'不可拖動且不可同時選擇?Make Famo.us/Angular fa-image不可選

我在'fa-container-surface'中顯示此表面,並且想要禁用圖像選擇,因爲滾動和拖放不起作用,如果彈出窗口出現以保存圖像。

我試圖設置這個CSS:

.unselectable { 
    /* For Opera and <= IE9, we need to add unselectable="on" attribute onto each element */ 
    /* Check this site for more details: http://help.dottoro.com/lhwdpnva.php */ 
    -moz-user-select: none; /* These user-select properties are inheritable, used to prevent text selection */ 
    -webkit-user-select: none; 
    -ms-user-select: none; /* From IE10 only */ 
    user-select: none; /* Not valid CSS yet, as of July 2012 */ 

    -webkit-user-drag: none; /* Prevents dragging of images/divs etc */ 
    user-drag: none; 

}

但這無法在Chrome網頁瀏覽器38或Windows Phone 8.1瀏覽器。圖像消失了,因爲一個錯誤的:

Syntax Error: Token 'unselectable' is an unexpected token at column 18 of the expression [hexagon-tile-img unselectable] starting at [unselectable] 

在HTML中,我知道,我們可以設置「不可選擇=‘對’」或「可拖動=‘假’,」關於「IMG」,但如果我嘗試這樣做不考慮'fa-image-surface'屬性。

有沒有人有想法在famo.us/Angular項目中做到這一點?

回答

0

適用於您的hexagon-tile-img的唯一CSS類 - 嘗試將unselectable添加到類屬性中,只是爲了測試它將在img元素上正常工作。

在您的樣式表中,您可以嘗試使用.unselectable > img基本上將不可選規則應用於容器中的子元素img

此外,不要指望famo.us在IE上工作,因爲IE尚未實現preserve-3d,這對於將3d變換應用到子元素至關重要。

+0

我試圖設置'取消選擇'類屬性,但我忘了設置它在我的問題。我修改了它。 所以,如果我將這個CSS添加到我的'fa-image-surface'中,圖像不會顯示。 而在Windows Phone 8.1上的IE版本是IE 11,所以它應該工作(現在它適用於我,除了這個選擇案例)。 – 2014-11-03 10:34:53

+0

我剛剛嘗試複製您在Famo.us大學(Angular部分)中描述的問題,並且發現fa-image-surface需要結束不允許拖動「solidus」 。嘗試將.unselectable類添加到fa-image-surface,並添加結束標記。 – 2014-11-03 10:55:29

+0

關於關閉fa-image-surface標籤是正確的。 但我總是有同樣的問題。 但是,在調試窗口中,我有這個錯誤:語法錯誤:令牌'不可選'是在表達式[hexagon-tile-img unselectable]從第18列開始的意外令牌[unselectable] 這很奇怪,因爲如果我刪除'hexagon -tile-img'classname,一切正常。 fa-surface-image中是否有超過2個類名? – 2014-11-03 13:15:11