Christopher Marshall
Christopher Marshall

Reputation: 10736

How do I hide the Next anchor in my custom Nivo nav if it has less than six images?

I'm working on a custom navigation thumbnail slider for the Nivo Slider Jquery plugin.

I'm trying to hide the Next anchor when the thumbnail slider contains less than or equal to 6 thumbnails.

.nivo-control is the anchor the thumbnail images are children of, and they are all children of .items.

I've already tried:

        if  ($('.items').children('.nivo-control') <= 6) {
            $('a.next').css('display', 'none !important');
        } else {
            // Do something
        }

Upvotes: 2

Views: 634

Answers (2)

ryudice
ryudice

Reputation: 37376

Use

    if  ($('.items').children('.nivo-control').length <= 6) {
        $('a.next').css('display', 'none !important');
    } else {
        // Do something
    }

Upvotes: 6

user610217
user610217

Reputation:

Try this:

   if  ($('.items').children('.nivo-control').length <= 6) {
        $('a.next').css('display', 'none !important');
    } else {
        // Do something
    }

Upvotes: 5

Related Questions