how to make colorbox responsive

前端 未结 16 1110
情歌与酒
情歌与酒 2021-01-30 13:35

I am using colorbox in a responsive website.

I have a request : I wish that Colorbox automatically adjusts itself to the size and orientation of the screen / mobile devi

16条回答
  •  不知归路
    2021-01-30 14:04

    This one is working properly brothers.

    jQuery( document ).ready( function(){
    var custom_timeout = ( function() {
        var timers = {};
        return function ( callback, ms, uniqueId ) {
            if ( !uniqueId ) {
                uniqueId = "Don't call this twice without a uniqueId";
            }
            if ( timers[uniqueId] ) {
                clearTimeout ( timers[uniqueId] );
            }
            timers[uniqueId] = setTimeout( callback, ms );
          };
    })(); 
    $(".group1").colorbox({rel:'group1', width:"80%" }); 
    $( window ).resize( function(){
        custom_timeout(function(){
            if( $('#cboxOverlay' ).css( 'visibility' ) ){
                $(".group1").colorbox.resize({ innerWidth:'80%' });
            }
        }, 500 );
    }); 
    

    });

    Visit demo page

提交回复
热议问题