簡體   English   中英

用戶如何在SharePoint中手動增加或減少頁面中所有內容的字體大小?

[英]How a user can manually increase or decrease font size of all the content in a page in SharePoint?

我有一個要求,用戶可以使用鏈接或按鈕單擊來增加(A +)或減少(A-),以影響SharePoint頁面中整個內容的字體大小。 我將SharePoint Online(Office365)用於POC。 我嘗試將內容編輯器Webpart與html和js結合使用:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function()
{
$('button').click(function()
{
var theElement = $("div").css("font-size");
var textSize = parseFloat(theElement, 10);
var unitOfMeasurement = theElement.slice(-2);

if ( (this).id == "largerTextLink")
{
textSize += 2;
}
else
{
textSize -= 2;
};

$('div').css("font-size", textSize + unitOfMeasurement);

return false;
});
});
</script>
<body>
<div class="font-button">
<button id="smallerTextLink">Smaller Text</button>

<button id="largerTextLink">Larger Text</button>
</div>
</body>

但是上面的代碼沒有反映任何內容,只是頁面被刷新了。 作為初級開發人員,我不知道我是否走了正確的道路。 有什么方法或替代方法可以解決此要求?

您可以為此使用em

這是一個類似問題的很好的答案/示例: https : //stackoverflow.com/a/16461139/3021549

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM