Mar 4
2010

jQuery carousel lite with dynamic paging

Category: Thomas Frost @ 11:29 AM

sorry for the missing description. I will might but it on later

Resources

http://www.gmarwaha.com/jquery/jcarousellite/

http://groups.google.com/group/jquery-en/browse_thread/thread/9fec8a1746945bd2

index.htm

<script src="jcarousellite_1.0.1.min.js" type="text/javascript"></script>

<ul class="paging"></ul>
// build links  
var itemArray = new Array();
$('.carousel ul').each(function(i) {
    var carouselNavDivs = $('ul.paging');
    $(carouselNavDivs[i]).append('<li class="prev"><a><<</a></li>');
    $(this).children().each(function(j) {
        itemArray[j] = "." + j;
        var linkNum = 0;
        linkNum = j + 1;
        $(carouselNavDivs[i]).append("<li class='" + j + "'><a>" + linkNum + "</a></li>");
    });
    $(carouselNavDivs[i]).append('<li class="next"><a>>></a></li>');
});

$(function() {
    $(".carousel").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
        btnGo: itemArray,
        circular: false,
        visible: 1
    });
});

jcarousellite_1.0.1.min.js

if (o.btnGo)
    $.each(o.btnGo, function(i, val) {
        $(val).click(function() {
            $.each(o.btnGo, function(i, val) {
                $(val).removeClass('active');
            });
            $(this).addClass('active');
            return go(o.circular ? o.visible + i : i);
        });
    });

 

Still needs to be able to select current when using prev/next

Tags:

kick it on DotNetKicks.com

Feb 19
2009

Ignore query in jQuery treeview persist location

Category: Programming Thomas Frost @ 06:40 AM

The jQuery treeview plugin can be found here, it is a brilliant plugin which makes amazing treeviews.

But when i use:

persist: "location"

 I run into a little "problem", because i would like to have the treeview item selected when i use query's in the URL, and as default it just doesn't select any when using query.

What I need to do is to detect if there is a query in the url and then ignore it, I've done it the following way:

case "location":

var current = this.find("a").filter(function()
{
    return this.href.substring(0, (this.href.indexOf("?") == -1) ? this.href.length: this.href.indexOf("?")).toLowerCase() == location.href.substring(0, (location.href.indexOf("?") == -1) ? location.href.length: location.href.indexOf("?")).toLowerCase();
});

It is a pretty simple fix and works like a charm!

 

EDIT:

This version is also able to handle bookmarks and query in url.

case "location":

var current = this.find("a").filter(function()
{
    var linkLength = (this.href.indexOf("?") != -1) ? this.href.indexOf("?") : (this.href.indexOf("#") != -1) ? this.href.indexOf("#") : this.href.length;
    var link = this.href.substring(0, linkLength);

    var urlLength = (location.href.indexOf("?") != -1) ? location.href.indexOf("?") : (location.href.indexOf("#") != -1) ? location.href.indexOf("#") : location.href.length;
    var url = location.href.substring(0, urlLength);

    return link.toLowerCase() == url.toLowerCase();
});

 

Tags: , ,

kick it on DotNetKicks.com

Oct 16
2008

A quick introduction to jQuery

Category: Programming Thomas Frost @ 02:09 AM

I've been looking at jQuery for some hours now, and i must say that im amazed! It's very light-weight and incredibly powerful with it's big library and ui.

Here is a list with some of the links i found use full in my quest to learn jQuery:

I haven't played arround with it a lot, but I will do it as soon as posible, so there will be a bigger introduction with examples etc. later on.

Tags: ,

kick it on DotNetKicks.com