简体   繁体   English

Contentflow-如何使字幕文本动态调整大小?

[英]Contentflow - how to make caption text to dynamic resize?

I am trying to add text to the images in contentflow but as I scroll through them I need the text to resize so the text does not move. 我正在尝试向内容流中的图像添加文本,但是当我滚动它们时,我需要调整文本的大小,以使文本不会移动。

http://www.jacksasylum.eu/ContentFlow/index.php http://www.jacksasylum.eu/ContentFlow/index.php

I don't know if there's automatic way of doing this, but as of responsive web design you can hardcore the font size through CSS or using jQuery. 我不知道是否有自动的方法,但是从响应式网页设计开始,您可以通过CSS或使用jQuery来增强字体大小。

jQuery jQuery的

$(window).on('resize', function(event) {
    if($(window).width() < 400) {
        $('.CAPTIONCLASS').css("font-size", "20");
    }
    else {
        $('.CAPTIONCLASS').css("font-size", "10");
    }
});

CSS CSS

@media screen and (max-width: 400px) {
    .CAPTIONCLASS {
        font-size: 20px;
    }
}

@media screen and (max-width: 100px) {
    .CAPTIONCLASS {
        font-size: 15px;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM