jquery slider is not working in ie

I am working on my own jquery slider.it does work correctly in Chrome and FireFox but not in IE.here is my scripts. Does anybody has a solution for it?

here is my CSS:

<style>
  #rol{
      display: block;
        width:950px;
        height:154px;
        margin:0 auto;
        overflow:hidden;
    }

    #rol .prev-r,.next-r{
        position:absolute;
        margin-top:60px;
        width:11px;
        height:37px;
        cursor:pointer;
    }

    #pos{
        width:1500px;
        float:left;
    }

    .next-r{
        background:url(/themes/classic/images/slider/rol-next.png) no-repeat;
    }
    .prev-r{
        background:url(/themes/classic/images/slider/rol-prev.png) no-repeat;
    }
    .next-r:hover{
        background:url(/themes/classic/images/slider/rol-next.png) no-repeat 0 -50px;
    }
    .prev-r:hover{
        background:url(/themes/classic/images/slider/rol-prev.png) no-repeat 0 -50px;
    }
    .partner-box {
        color: white;
        width: 218px;
        height: 154px;
        border: ridge 1px #666;
        background-color: #16455D;
        float: left;
        margin: 0 10px 0 8px;
    }
</style>

and it is my html :

<div id="rol">
    <p style="float:left;margin-left:-20px;display:block;" class="prev-r"></p><p style="float:left;margin-left:960px;display:none;" class="next-r"></p>
    <div id="pos">
        <div class="partner-box">
            <img src="partner/5prime.jpg" width="218" height="65" />
            <p>
                Nucleic Acid Purification, PCR and RT PCR, Molecular Biology Reagents, Lab Essentials and Accessories ...
            </p>
            <a class="read-more" href="/partners/view/5prime">Read More</a>
        </div>
        <div class="partner-box">
            <img src="partner/metabion_header.jpg" width="218" height="65" />
            <p>
                Oligonucleotides & Peptides :<br/> DNA, RNA, ZNA, Dual labeled probes, Light Cycler probes, Peptides, Antibodies
            </p>
            <a class="read-more" href="/partners/view/metabion">Read More</a>
        </div>
        <div class="partner-box">
            <img src="partner/54564.jpg" width="218" height="65" />
            <p>
                We supply wide range of Real Time PCR, PCR and FEP kits for molecular diagnostics from InterLab Service Company ...
            </p>
            <a class="read-more" href="/partners/view/interlabservice">Read More</a>
        </div>
        <div class="partner-box">
            <img src="partner/logo_corpo[1].jpg" width="218" height="65" />
            <p>
                IPSOGEN is currently the world leader in blood cancer molecular diagnostics ...
            </p>
            <a class="read-more" href="/partners/view/Ipsogen">Read More</a>
        </div>
        <div class="partner-box">
            <img src="partner/partner_cytocell.gif" width="218" height="65" />
            <p>
                IPSOGEN is currently the world leader in blood cancer molecular diagnostics ...
            </p>
            <a class="read-more" href="/partners/view/cytocell">Read More</a>
        </div>
        <div class="partner-box">
            <img src="partner/aid.jpg" width="218" height="65" />
            <p>
                IPSOGEN is currently the world leader in blood cancer molecular diagnostics ...
            </p>
            <a class="read-more" href="/partners/view/Aid-Diagnostika">Read More</a>
        </div>
    </div>
</div>

and finally here is my jquery script.i use jquery-1.7.1.min.js:

<script type="text/javascript">
$(document).ready(function() {
    //img floating
    var lock = true;
    $('.prev-r').click(function() {
        if(lock == true){
            lock = false;
            var mleft = $('#pos').css('marginLeft');
            var mleft = mleft.slice(0,-2);
            var mleft = parseInt(mleft);
            var mleft = Math.abs(mleft);
            var left = 240;
            var next = mleft+left;
            chdis(next);
            $('#pos').animate({
                'marginLeft':'-'+next
                },"slow",function(){
                lock = true
                });
        }
    });
    $('.next-r').click(function() {
        if(lock == true){
            lock = false;
            var mleft = $('#pos').css('marginLeft');
            var mleft = mleft.slice(0,-2);
            var mleft = parseInt(mleft);
            var mleft = Math.abs(mleft);
            var left = 240;
            var next = mleft-left;
            chdis(next);
            $('#pos').animate({
                'marginLeft':'-'+next
                },"slow",function(){
                lock = true
                });
        }
    });
    function chdis(next){
        if(next == 0){
            $('.next-r').css('display','none');
        }else{
            $('.next-r').css('display','block');
        }
        var img = $("#pos img").length;
        var img = img * 240;
        var img = Math.abs(img);
        var img = img - 950;
        if(next == 480){
            $('.prev-r').css('display','none');
        }else{
            $('.prev-r').css('display','block');
        }
    }
});

Answers


I've found my problem.

IE automatically set #pos left-margin to auto.So when I try to slice it and want to retrieve digits from its value(for example want to get 12 from 12px) it gives me au instead(because the margin-left is set to auto). by setting the left margin for #pos with zero, the slider works in IE too. Good luck


Need Your Help

Best way to convert pdf files to tiff files

pdf image tiff

I have around 1000 pdf filesand I need to convert them to 300 dpi tiff files. What is the best way to do this? If there is an SDK or something or a tool that can be scripted that would be ideal.

Problem in System.out.println statement

java import

Whenever we write any statement to print to console in Java program:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.