Rerun jquery plugin instance on window resize

Rerun jquery plugin instance on window resize

By : user2948090
Date : November 14 2020, 04:48 PM
Hope this helps I want to build a plugin that will be centerizing stuff for me, but I wanted to automate rerun every instance of it after window resizing, here's some (not-working on window resize) code: , Problem with context:
code :
$.fn.centerize = function(){
    var divWidth = this.width(),
        screenWidth = $(window).width(),
        margin = (screenWidth - divWidth)/2,
        _this = this;

    this.css({'margin-left':margin + 'px', 'margin-right': margin + 'px'});
$.fn.centerize = function(){
    var divWidth = this.width(),
        screenWidth = $(window).width(),
        margin = (screenWidth - divWidth)/2;

    this.css({'margin-left':margin + 'px', 'margin-right': margin + 'px'});
    $(window).resize($.proxy($.fn.centerize, this);

Share : facebook icon twitter icon
jQuery plugin not being called on window resize

jQuery plugin not being called on window resize

By : Prashant Kumar
Date : March 29 2020, 07:55 AM
it should still fix some issue The function expression, i.e. the variable updateOvalTables is declared after the $.each function. It still gets hoisted, but in the .each loop updateOvalTables is undefined. You're also declaring the variables after the return statement, which is a bit late.
So this:
code :
$(document).on('click', foo);

var foo = function() { alert(); }
var foo = function() { alert(); }

$(document).on('click', foo);
(function($) {
    gstable: function(options) {

        //Define default options.
        var defaults = {
            scrsplit : 767,         //Modify table when screen gets to this size.
            tblwidth : "1024px"     //Default table width when on a small screen (screen width < scrsplit).

        var o                = $.extend(defaults, options),
            $obj             = $(this),
            switched         = false;
            updateOvalTables = function() {
                if (($(window).width() < o.scrsplit) && !switched ){
                    switched = true;
                    //return true;
                }   else if (switched && ($(window).width() > o.scrsplit)) {
                    switched = false;

        return this.each(function() {

            $obj.wrap("<div class=\"table-wrapper\" style=\"overflow:auto;\" />");
            if ($(window).width() < o.scrsplit){
                $obj.wrap("<div style=\"width:"+o.tblwidth+"\" />");
            } else {
                $obj.wrap("<div style=\"width:100%;\" />");

            $(window).bind("resize", updateOvalTables);

        function splitOvalTable(elem) {
            elem.parent().css("width", o.tblwidth);   

        function unsplitOvalTable(original) {
            elem.parent().css("width", "100%");   

Retrigger jQuery Plugin on Window Resize?

Retrigger jQuery Plugin on Window Resize?

By : maker
Date : March 29 2020, 07:55 AM
I wish this help you I think a syntax error is causing your code to not fire. Change your code to:
code :
$(window).resize(function () {
if ( $(window).width() >= minWidth){
        includePadding: true,
        wheelPropagation: true
updating jquery plugin settings on window resize

updating jquery plugin settings on window resize

By : Aggi
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I have a jquery plugin I'm writing that has default values, and of course the ability for folks to define their own values for those variables.
code :
var settings = $.extend({
    width: $(window).width(),
    height: $(window).height(),
    rotate_btn: $(".rotate_js")
}, options );

$(window).on('resize.myCustomEventName', function(event) {
        $.extend(settings, {
            width: $(window).width(),
How to re-run this jQuery plugin on window resize?

How to re-run this jQuery plugin on window resize?

By : Halo
Date : March 29 2020, 07:55 AM
may help you . Your current implementation already adapts to the new window size as soon as the fade-out completes and the next call to rotaterator is made.
If however you want an immediate effect at the resize event, so that the animation restarts taking the new window size into account, then use the jQuery stop method to stop any current animations of an ul child element.
code :
$(window).resize(function() {
    $('ul *').finish();
    $('ul').rotaterator({fadeSpeed:5000, pauseSpeed:1000});
Jquery Plugin: how use window resize?

Jquery Plugin: how use window resize?

By : shivakumar
Date : March 29 2020, 07:55 AM
Hope that helps Two problems here
that you're applying the css to the window. that part of your code is after the return statement.
Related Posts Related Posts :
  • TabIndex - hitting tab moves me to Address Bar - unable to work around this using Focus
  • Create JSON from string, to use as object
  • Jquery - How do I make ifModified:true work in .ajax request?
  • Jquery and create html on the fly
  • jQuery Validation not validating on button click
  • Jquery Draggable/Droppable appending multiple divs
  • jQuery selector not working properly. Possible Sizzle bug?
  • enable anchor in twitter bootstrap modal
  • jQuery keydown : Wait for previous event to finish
  • why magnific popup ajax box closes if clicked on content
  • JQPlot pie charts "jqplotDataClick" event fires multiple times
  • Show div as the page scrolls on div height
  • Keypress event for ajax call does not work
  • responsive/fluid jQGrid with Twitter Bootstrap
  • IE10 does not seem to fire load event
  • Remove tipTip tool tip
  • jquery datepicker changing unavailable dates in one instance
  • TableTools plugin export buttons are not working
  • Prepopulate jquery token input textbox
  • Open a fancybox link with ajax
  • Getting jQuery and AngularJS content assist / auto-complete in eclipse for standalone HTML "file"
  • TR alternate background colour with unequal number of TD
  • DATATABLE jQuery TH and TD alignment
  • Jquery UI Convert Select's to Range Slider
  • Change text in text field according to link that has been clicked
  • Animate addClass + removeClass transitions?
  • knockout ajax call data-BIND
  • How do I create a variable with a number based on an element's number position using jquery?
  • Prevent fixed position element from flickering during jQuery animation
  • points are not visible clearly in nvd3 ghaph
  • How to write a regular expression for IP address format
  • Animate 3 DIVs from right to left when page is loading.
  • How to pivot columns in free jqgrid 4.15.4
  • the jquery method works fine but when made as a function not working
  • Show/hide text doesn't work when targeting link within div
  • multiple autocomplete search input fields
  • Display image in cell using Jquery jTable
  • jQuery and Wordpress - Scripts not working
  • flickering when mouse over, .hover() show/hide div(s)
  • Using Django's JSONResponseMixin to respond to AJAX requests
  • Unable to render charts using Wicked PDF
  • Style to dynamically created elements
  • hover not working for items in list
  • Keep server session alive automatically based on activity / input, using JQuery
  • jQuery load() taking a long time
  • Change / Exchange values in textboxes on text change in jquery
  • Unslider arrow code overriding slider options
  • what is the traditional way of sorting search results?
  • Do the action when the DIV comes in the display area of the browser with jQuery
  • jQuery slideshow overlapping CSS ribbon
  • JQuery animate function dont work
  • problems charts jquery highcharts
  • How to reset the select box values in Jquery sumoselect Multi select plugin
  • css absolute position on top of another element
  • How use jQuery String variable in html body
  • Get a row from table in view on modal bootstrap using codeigniter
  • How to make the effect of a div that covers an other div when scrolling?
  • Data binding using a button
  • How do i replace all dot in string to Underscore?
  • grab non-sibling element with jquery
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org