我在我的項目中使用了Google reCAPTCHA 2,並且想爲CAPTCHA設置一個寬度,因爲我的項目應該有響應式設計,但不知道如何做到這一點。如何更改reCAPTCHA的寬度?
1
A
回答
0
這裏是我使用的一種技術,您可以在其中調整transform屬性並動態獲取比例值。如果您有各種不同的尺寸,這非常棒。如果你只有1或2個表單,最好使用CSS類。請參閱本文以供參考:https://www.geekgoddess.com/how-to-resize-the-google-nocaptcha-recaptcha/
var timer = setTimeout(function() {
/**
* We're in a timer b/c something weird happens to the container at load time.
* If that does not happen for you, by all means remove the timer.
* Container is the recaptcha div
* Check if the captcha is bigger than the parent container
* If so, scale it down. Be warned, if you scale too much
* things get a bit weird.
*/
var childWidth = container.offsetWidth,
parentWidth = container.parentElement.offsetWidth;
if (childWidth >= parentWidth) {
/* console.log('too big'); */
container.style.transform = 'scale(' + parentWidth/childWidth + ')';
container.style.transformOrigin = '0px 50% 0px';
}
clearTimeout(timer);
}, (60 * 2));
UPDATE:谷歌已經增加了通過參數更小尺寸的支持。看一看的文檔 - https://developers.google.com/recaptcha/docs/display#render_param
0
我的解決辦法:
#recaptcha_widget_div {
overflow: visible;
transform: scaleX(0.9);
margin-left: -15px;
}
0
以下樣式屬性爲我工作。添加到iframe上方的特定div元素。
html #recaptcha_area, html #recaptcha_table {
transform: scale(0.77);
-webkit-transform: scale(0.77);
transform-origin: 0 0;
-webkit-transform-origin: 0 0;
}
相關問題
- 1. 更改新的谷歌的Recaptcha寬度
- 2. 修改recaptcha表寬度
- 3. 如何使用css更改google recaptcha寬度框?
- 4. 如何更改recaptcha
- 5. 如何更改UITableviewCell寬度
- 6. 如何更改FBLoginView寬度
- 7. 如何更改UISearchBar寬度
- 8. 如何更改ImageView高度和寬度
- 9. TTStyledTextLabel如何更改方向更改的寬度/高度?
- 10. 如何更改UITableView行的寬度
- 11. 如何更改容器的寬度?
- 12. Bootstrap:如何更改容器的寬度?
- 13. Bootstrap - 如何更改表格的寬度
- 14. 如何更改DrawFocusRect筆的寬度?
- 15. Bootstrap:如何更改容器的寬度
- 16. 如何更改h的寬度:outputLabel
- 17. 如何更改容器的寬度?
- 18. 如何更改iPad中UIActionSheet的寬度?
- 19. 如何更改ScrollBar的寬度?
- 20. 如何更改錶行的寬度
- 21. 如何更改表格的寬度
- 22. 如何更改iframe內的Iframe寬度?
- 23. 如何更改sidenav隱藏的寬度?
- 24. 如何更改Primefaces組件的寬度?
- 25. 如何更改DataGridView列的寬度
- 26. 如何更改Joomla模塊的寬度
- 27. 如何更改UINavigationItem :: leftBarButtonItem的寬度?
- 28. 如何更改select2標籤的寬度?
- 29. 如何更改uitableviewcell的寬度
- 30. 如何更改Datatable的列寬度