我知道tumblr的圖片尺寸有{photoset-500},{photoset-400},{photoset-250},但我想更改寬度,以便寬度可以是420或350.我到處尋找,找不到代碼來幫助我做到這一點。在tumblr上更改默認圖片尺寸
1
A
回答
1
您不能使用Tumblr標記更改圖像的默認尺寸,但您可以使用CSS在視覺上更改尺寸。
的tumblr標記:
{block:Photoset}
{block:Photos}
<img src="{PhotoURL-500}" class="photoset-img" />
{/block:Photos}
{/block:Photoset}
CSS:
.photoset-img { width: 420px; /* can be any value you want */ }
1
結束標記之前添加此腳本。這將增加或減少photoset的大小
<script type="text/javascript">
//This will change the source address and display the correct size.
$(".photoset").each(function() {
var newSrc = $(this).attr("src").replace('700','860');
$(this).attr("src", newSrc);
});
//This will get the new size of the iframe and resize the iframe holder accordingly.
$(function(){
var iFrames = $('.photoset');
function iResize() {
for (var i = 0, j = iFrames.length; i < j; i++) {
iFrames[i].style.height = iFrames[i].contentWindow.document.body.offsetHeight + 'px';}
}
if ($.browser.safari || $.browser.opera) {
iFrames.load(function(){
setTimeout(iResize, 0);
});
for (var i = 0, j = iFrames.length; i < j; i++) {
var iSource = iFrames[i].src;
iFrames[i].src = '';
iFrames[i].src = iSource;
}
} else {
iFrames.load(function() {
this.style.height = this.contentWindow.document.body.offsetHeight + 'px';
});
}
});
</script>
2
您可以使用{} Photoset剛剛調整大小的photoset以適應集裝箱(最大尺寸700像素)。
相關問題
- 1. PHP:默認圖片尺寸
- 2. 增加tumblr照片尺寸
- 3. 在tumblr中選擇照片尺寸API
- 4. iOS:UIPickerView默認尺寸
- 5. 用Woo Commerce更改圖片尺寸
- 6. 默認圖像尺寸在IE8
- 7. docbook5默認值的圖形尺寸
- 8. 更改圖的尺寸MATLAB
- 9. 更改尺寸
- 10. 更改波旁威士忌默認em尺寸
- 11. 圖片WaterMark尺寸
- 12. 更改照片尺寸Windows Phone 8
- 13. 如何更改FAB默認圖片
- 14. 在jQuery中更改圖像的尺寸
- 15. 在Sympy.mpmath.plot中更改圖尺寸
- 16. 在方向更改期間更改照片尺寸
- 17. 更改TTPhotoView尺寸
- 18. 更改尺寸JButton
- 19. 查看上傳的圖片尺寸
- 20. PHP正確尺寸上傳圖片
- 21. 大尺寸PHP上傳圖片
- 22. 調整上傳圖片的尺寸
- 23. 獲取上傳圖片的尺寸?
- 24. 上傳WordPresspress最小圖片尺寸
- 25. 標準尺寸的上傳圖片(PHP)
- 26. HTML畫布尺寸是正確的,但上下文使用默認的尺寸
- 27. 尺寸背景圖片?
- 28. WallpaperManager錯誤圖片尺寸
- 29. 圖片尺寸奇數
- 30. 小尺寸圖片問題
不要忘了調整高度。 '.photoset-img {width:420px;身高:自動; }' – graygilmore 2012-07-20 23:33:03
'auto'是默認值 – 2012-07-21 02:34:19