Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • In case you want a demo of the above code working, have a look at https://tipsrated.com

    Cheers and thanks Max for the plugin in the first place. Very useful!

    It’s actually quite easy. I customised the js file …

    In the function fixed_widget(widget) add a couple more vars …

    var widget_height = widget.obj.css('height');
    var widget_replacement = widget.obj.attr('id')+'_replacement';

    then after if ( !style_applied_bottom ) { … change to this…

    widget.obj.css('position', 'fixed');
    widget.obj.css('top', '');
    widget.obj.css('width', widget_width);
    widget.obj.css('margin', widget_margin);
    widget.obj.css('padding', widget_padding);
    if(jQuery('#'+widget_replacement).length <= 0) {
    	widget.obj.after('<div id="'+widget_replacement+'" style="height:'+widget_height+';"></div>');
    }
    style_applied_bottom = true;
    style_applied_top = false;
    style_applied_normal = false;

    then after if ( !style_applied_top ) { … change to this…

    widget.obj.css('position', 'fixed');
    widget.obj.css('top', widget.fixed_margin_top);
    widget.obj.css('bottom', '');
    widget.obj.css('width', widget_width);
    widget.obj.css('margin', widget_margin);
    widget.obj.css('padding', widget_padding);
    					if(jQuery('#'+widget_replacement).length <= 0) {
    	widget.obj.before('<div id="'+widget_replacement+'" style="height:'+widget_height+';"></div>');
    }
    style_applied_top = true;
    style_applied_bottom = false;
    style_applied_normal = false;

    then after if ( !style_applied_normal ) { … change to this…

    if(jQuery('#'+widget_replacement).length > 0) {
    	jQuery('#'+widget_replacement).remove();
    }
    widget.obj.css('position', '');
    widget.obj.css('top', '');
    widget.obj.css('width', '');
    widget.obj.css('margin', '');
    widget.obj.css('padding', '');
    style_applied_normal = true;
    style_applied_top = false;
    style_applied_bottom = false;

    The code isn’t necessarily perfect but you get the idea. I’ve only tested on a top positioned sticky widget, which works very well. Not sure if it works as well with a bottom fixed widget.

    Anyway, hope it helps.

Viewing 2 replies - 1 through 2 (of 2 total)