简体   繁体   中英

select box jquery transition not working

I am trying to use this: http://abeautifulsite.net/blog/2011/01/jquery-selectbox-plugin/

to add a transition by default to my select-box.

This is the bit of JavaScript:

$(document).ready( function() {

    $("SELECT").selectBox()
    $("SELECT").click( function() { 
        $("SELECT").selectBox('settings', { 
            'menuTransition': 'slide',
            'menuSpeed' : 'fast' 
        });
    });

});

I can't seem to make it slide by default. What am I doing wrong? I was able to get it to work by including a separate button exactly like in the demo page. But I want it to use the slide animation by default and can't see/figure out what is wrong?

The selectBox plugin looked interesting so I tried it out and I believe your issue is that you are trying to dynamically set the transition type to slide but you want to create the selectBox with different settings than the default ones, try this:

$(document).ready( function() {
    $("SELECT").selectBox({
        menuTransition : 'slide',
        menuSpeed      : 'fast'
    });
});

Here is a working example of this solution: http://jsfiddle.net/jasper/APzDJ/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM