问题描述:

Hi all I have this script, and I want when .mouseover width < 300px font-size make 16px but not work, how can I do this?

$('.mouseover').mouseover(function(){

var a = $(this).width();

if( a < 300 ){

$('.video_name').css({"font-size":"16px"});

});

网友答案:

Working demo: http://jsfiddle.net/982oe17q/2/

$('.mouseover').mouseover(function(){
    var a = $(this).width();
    if (a < 300) {
        $('.video_name').css({"font-size":"16px"});
    }
});

You were missing the closing } for the anonymous function, closing ) for the mouseover function, and a ; at the end of the mouseover call.

相关阅读:
Top