dpd7195 2011-04-28 18:56
浏览 13
已采纳

最简单的方法来编辑“捐赠温度计”

I am trying to think of the best way to make a really small thermometer image, that can be easily edited by typing in a number (dollar value) and having the image change based on the value.

The simplest way to achieve this is the best. It will be going online onto a site that is using a CMS called spip.

Does anything small like this exist? and if i have to create it myself what's the best way to go about it?

  • 写回答

6条回答 默认 最新

  • dqppv86022 2011-04-28 19:12
    关注

    The basic concept here is very simple; check out this fiddle. It's a basic nested div:

    <div id='thermometer'>
        <div id='level'>
        </div>
    </div>
    

    which takes input from some form element:

    <input type='text' id='fill'>
    

    and some simple styling:

    #thermometer { height: 15px; width: 100px; margin:5px; padding:0; border: #cccccc solid 1px; }
    #level { height: 15px; width: 40px; margin: 0; padding:0; border-right: 1px solid #666666; background: #ffcccc; }
    

    and a tiny bit of javascript:

    $('#fill').keyup(function() {
        $('#level').css('width',this.value);
    });
    

    Granted, this has no error checking, and could use a lot more work to make it robust, but it does what you ask it to do.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(5条)

报告相同问题?

悬赏问题

  • ¥15 网络设备配置与管理这个该怎么弄
  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器