Problem with jQuery Sparkline in IE

I used jQuery sparkline ( http://omnipotent.net/jquery.sparkline/ ) on the page. This gives me problems in IE, if the DIV container is not large enough to show it, tried it with Firefox / Chrome, it works fine. See Sample Code,

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <script type="text/javascript" src="jquery-1.3.1.js"></script>
    <script type="text/javascript" src="jquery.sparkline.min.js"></script>
    <script type="text/javascript">
    $(function() {
        var myvalues = [10,8,5,7,4,4,1];
        $('.dynamicsparkline').sparkline(myvalues, {height:'100px',width:'300px'});
    });
    </script>
</head>
<body>
<div style="height:100px;width:400px;overflow:auto;border:1px solid black">
          Testing Header
          <br/>
          <span class="dynamicsparkline">Loading..</span>
          <br/>
          Testing Footer
</body>
</html>

Can someone help me here?

Thanks Manoj

+3
source share
1 answer

Gareth Watts ( http://omnipotent.net/jquery.sparkline/ ) helped me solve this problem by adding "position: relative" to the container div.

here is the code

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <script type="text/javascript" src="jquery-1.3.1.js"></script>
    <script type="text/javascript" src="jquery.sparkline.min.js"></script>
    <script type="text/javascript">
    $(function() {
        var myvalues = [10,8,5,7,4,4,1];
        $('.dynamicsparkline').sparkline(myvalues, {height:'100px',width:'300px'});
    });
    </script>
</head>
<body>
<div style="height:100px;width:400px;overflow:auto;border:1px solid black;position: relative">
          Testing Header
          <br/>
          <span class="dynamicsparkline">Loading..</span>
          <br/>
          Testing Footer
</div>
</body>
</html>

It can only be played in IE7.

thanks

+2
source

Source: https://habr.com/ru/post/1710972/


All Articles