Gaurang Tandon
Gaurang Tandon

Reputation: 6781

Either of JQuery .css() or .hover() not working

My Code (Launch in full window).

My JS Code:

$(document).ready(function () {
    $("#play_buttton").hover(
        function () {
            $('#play_button').css({ "height": "240px", "width": "250px" });
        },
        function () {
            $('#play_button').css({ "height": "225px", "width": "220px" });
        }
    );
});

I think that this code must be creating the problem.

Problem: When , I hover over the image (#play_button) , nothing happens and its height and width don't change.Can anyone tell me how do I fix that.

Thanks.

Upvotes: 0

Views: 120

Answers (2)

Arfan Mahmood
Arfan Mahmood

Reputation: 162

Wrong spell at $("#play_butt*t*on").hover

Upvotes: 1

GautamD31
GautamD31

Reputation: 28773

It will be play_button not play_buttton

$(document).ready(function () {
    $("#play_button").hover(   // Here not play_buttton
        function () {
            $(this).css({ "height": "240px", "width": "250px" });
        },
        function () {
            $(this).css({ "height": "225px", "width": "220px" });
        }
    );
});

See this sample FIDDLE.

You can also .animate it like in this FIDDLE2

Upvotes: 7

Related Questions