Learn how to use jQuery at the Blog

Linderoth A/S « visit

  • Added 7 months ago
  • 89 Lines of Code shown
  • 2 Links of Interest
http://linderoth-as.dk
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Linderoth A/S - http://linderoth-as.dk

// Car list
if (typeof(Linderoth) == "undefined") Linderoth = {};
Linderoth.CarListFront = Linderoth.CarListFront || {
    initialize: function() {
        var _me = this;
        $(document).ready(function() {
            $('#spotContentSlides').cycle({
                fx:                 'scrollRight', 
	            easing:             'easeOutBack',
                delay:              0,
                speed:              500,
                timeout:            5000,
                before:             _me.onBefore,
                pager:              '#spotContentPager',
                pagerAnchorBuilder: _me.anchorBuilder
            });
        });
    },
    onBefore: function(currSlideElement, nextSlideElement, options, forwardFlag) {
        if (currSlideElement != nextSlideElement) {
            $('#spotContentPagerSelector').stop();
            $('#spotContentPagerSelector').animate({top: options.nextSlide * 39 + 'px'}, 500);
        };
    },
    onPagerClick: function(zeroBasedSlideIndex, slideElement) {
        $('#spotContentPagerSelector').stop();
        $('#spotContentPagerSelector').animate({top: zeroBasedSlideIndex * 39 + 'px'}, 500);
    },
    anchorBuilder: function(index, DOMelement) {
        return $('#spotContentPagerItem_' + index);
    }
};
Linderoth.CarListFront.initialize();

//Contact top

if (typeof(Linderoth) == "undefined") Linderoth = {};
Linderoth.CommonScripts = Linderoth.CommonScripts || {
    toggle: false,
    link: null,
    initialize: function() {
        var _me = this;
        $(document).ready(function() {
            $('#contactSlides').cycle({
                fx:                 'scrollDown', 
                delay:              0,
                speed:              300,
	            timeout:            0,
                pager:              '#toolBar',
                pagerAnchorBuilder: _me.linkBuilder,
                containerResize:    0
            });
            $(".toolbarLink").each(function(i) {
                $(this).bind("click", function() {
                    if (!_me.toggle) {
                        _me.open();
                    } else {
                        if (_me.link == this) {
                            _me.close();
                        }
                    }
                    _me.link = this;
                });
            });
            $("#contactTop img").bind("click", function() {
                _me.close();
            });
        });
    },
    open: function() {
        var _me = this;
	$("#contactContainer").css("display","block");
        $("#contactContainer").stop().animate({
            marginTop: "0px"
        }, 250);
        _me.toggle = true;
    },
    close: function() {
        var _me = this;
        $("#contactContainer").stop().animate({
            marginTop: (-1 * $("#contactContainer").height()) + "px"
        }, 250);
        _me.toggle = false;
    },
    linkBuilder: function(index, DOMelement) {
        return $('#toolbarLink_' + index);
    }
};
Linderoth.CommonScripts.initialize();