Posted By

almazom on 10/13/09


Tagged

jquery banner


Versions (?)

smoth movig background IE adaptation


 / Published in: jQuery
 

  1. $(document).ready(function(){
  2. var div_pics_top_css = {
  3. 'position':'absolute',
  4. 'top':'13px',
  5. 'left':'343px',
  6. 'height':'80px',
  7. 'width':'450px',
  8. 'background':'url(/images/all.jpg) repeat-x 0px 0px '
  9. }
  10.  
  11. $('div#pics_top').css(div_pics_top_css);
  12. setInterval ("move_gall()", 33);
  13. })
  14.  
  15.  
  16. function move_gall(){
  17. var b = $('div#pics_top').css('background').replace(/px/gi,'').split(' ');
  18. var l_pos = String(b[b.length-2]-1)+'px'
  19. $('div.pics_top').css('background-position',l_pos)
  20. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: almazom on October 13, 2009

in IE we have problem with getting "backgroud" css propertie of object.

Posted By: almazom on October 20, 2009

in opera problems

total variant:

$(document).ready(function(){ if ($.browser.opera){

    var div_pics_top_css = {
        'position':'absolute',
        'z-index':'500',
        'top':'13px',
        'left':'343px',
        'height':'80px',
        'width':'450px',
        'background-image':'url(/images/all.jpg)',
        'background-position':'0px 0px',
        'background-repeat':'repeat-x'
    }

}else{
    var div_pics_top_css = {
        'position':'absolute',
        'z-index':'500',
        'top':'13px',
        'left':'343px',
        'height':'80px',
        'width':'450px',
        'background':'url(/images/all.jpg) repeat-x 0px 0px '
    }


}

$('div#pics_top').css(div_pics_top_css);
setInterval ("move_gall()", 33);

})

function move_gall(){

if ($.browser.opera){
    var backpos = $('div.pics_top').css('background-position').replace(/px/gi,'').split(' ');
    var l_pos = String(backpos[0]-3)+'px 0px';
}else{
    var b = $('div#pics_top').css('background').replace(/px/gi,'').split(' ');
    var l_pos = String(b[b.length-2]-1)+'px';
}

$('div.pics_top').css('background-position',l_pos);

}

You need to login to post a comment.