Hello everyone.
I wrote a simple horizontal scrolling script (similar to 
http://www.panic.com/coda/ this ), but unfortunately it works only in Safari
and I have no idea why.. :-((
Here is the code:

$(function(){
        
        var current_item = 1;
        var last_item = 4;
        var item_width = 300;
        
        $(".prev").click(function() {
                if( current_item == 1 ) scroll(last_item);
                        else scroll(current_item-1);
        });
        
        $(".next").click(function(){
                if( current_item == last_item ) scroll(1);
                        else scroll(current_item+1);
        });
        
        $(".tab").click(function(){
                id = $(this).attr("id");
                scroll(id);
        });

        function scroll(to_item) {
                
                if( to_item < current_item ) {
                        difference = current_item - to_item;
                        amount = difference * item_width;
                        current_item = to_item;
                        
$(".items").animate({"margin-left":"+="+amount+"px"},"slow");
                } else {
                        difference = to_item - current_item;
                        amount = difference * item_width;
                        current_item = to_item;
                        
$(".items").animate({"margin-left":"-="+amount+"px"},"slow");
                }
                
        }
        
});


I really hope you can help me, I had never encountered this problem before.
Thanks, Leon.
-- 
View this message in context: 
http://www.nabble.com/Code-works-in-Safari-ONLY-tp15489385s27240p15489385.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to