vektor
vektor

Reputation: 117

jQuery don't work in Chrome

This code works fine in all browsers except Google Chrome, anybody know why?

$(document).ready(function () {
    var $1 = $(".1"),
        $title = $(".admintitle"),
        $box = $(".uno"),
        flag = false,
        flag2 = false,
        height = $1.height();
    $title.click(function () {
        $1.animate({
            height: flag ? height : 40
        }, function () {
            $box.css('overflow', flag ? 'hidden' : 'visible')
            $title.css('background-position', flag ? '-254px 0px' : '0px 0px')
        });
        flag = !flag;
    });
});

http://jsfiddle.net/xQMHK/

Upvotes: 0

Views: 87

Answers (2)

vektor
vektor

Reputation: 117

The final code and correct is this

http://jsfiddle.net/xQMHK/2/

$(document).ready(function () {
var $1 = $(".admin"),
    $title = $(".admintitle"),
    $box = $(".uno"),
    flag = false,
    flag2 = false,
    height = $1.height();
$title.click(function () {
    $1.animate({
        height: flag ? height : 40
    }, function () {
        $box.css('overflow', flag ? 'hidden': 'visible')
        $title.css('background-position', flag ? '-254px 0px': '0px 0px')
    });
    flag = !flag;
});
});

thanks everybody really!

Upvotes: 0

isherwood
isherwood

Reputation: 61143

One possibility is that you're using numbers as class values. That's not strictly prohibited, but it can require different selection tactics:

var $1 = $(".1")

becomes

var $1 = $('div[class~="1"]');

Upvotes: 3

Related Questions