Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7938255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:45:22+00:00 2026-06-03T22:45:22+00:00

I have previously asked a question about how can I write a code block

  • 0

I have previously asked a question about how can I write a code block in a shorter way, I got my answer and I started adapting it to my circumstances. But I ran into a small problem, here is the code I’m running :

var default_cluster_options = {
    limits : [ { min: 1224, items: 8 }, { min: 954, items: 6 }, { min: 624, items: 4 }, { min: 0, items: 2 } ]
};

var default_plugin_options = {
    containerID : "",
    first       : false,
    previous    : false,
    next        : false,
    last        : false,
    startPage   : 1,
    perPage     : 1,
    midRange    : 6,
    startRange  : 1,
    endRange    : 1,
    keyBrowse   : false,
    scrollBrowse: false,
    pause       : 0,
    clickStop   : true,
    delay       : 50,
    direction   : "auto",
    animation   : "fadeIn",
    links       : "title",
    fallback    : 1000,
    minHeight   : true,
    callback    : function(pages, items) {}
};

var Cluster = function(cluster_options, plugin_options) {
    this.options = $.extend({}, default_cluster_options, cluster_options);
    this.plugin_options = $.extend({}, default_plugin_options, plugin_options);
    this.limits = this.options.limits;
    this.inititate_shop();
};

Cluster.prototype.initiate_plugin = function(plugin_navigation, plugin_options) {
    var options = $.extend({}, this.plugin_options, plugin_options);
    return $(plugin_navigation).jPages(options);
};

Cluster.prototype.inititate_shop = function() {
    for (var i = 0; this.viewport_width <= this.limits[i].min; i++) {
        log(this.limits[i].min);
        log(this.viewport_width);
        this.initiate_plugin('.shop-items-navigation', {
            containerID : "shop-items-wrapper",
            perPage     : this.limits[i].items,
            midRange    : 8,
            animation   : "fadeIn",
            links       : "blank",
            keyBrowse   : true,
            callback    : function(pages) {
                log(pages.current);
            }
        });
    }
};

var cluster = new Cluster();

Some of the code in there might not make sense because there are other code blocks, but I think that’s all the code related to my problem that may cause issues.

And my problem would be the for() loop inside the Cluster.prototype.inititate_shop property. I see no error in the console but when I tried to see if another loop works on the this.limits variable ( which is an array of 4 objects ) it did.

So that’s why I don’t see why the function won’t work or the for() loop would break and I’m asking here if anyone spots something I don’t ( I have a history of missing things ).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:45:24+00:00Added an answer on June 3, 2026 at 10:45 pm

    From the comments above – the problem is that your highest min value in the limits list is 1224 but your viewport width is 1366 so:

    this.viewport_width <= this.limits[i].min;
    

    never evaluates to true and the code in the for loop is never executed.

    EDIT 2

    What about if you break out the statement that does the check:

    Cluster.prototype.inititate_shop = function() {
    for (var i = 0; i < this.limits.length; i++) {
        if (this.viewport_width >= this.limits[i].min){
            log(this.limits[i].min);
            log(this.viewport_width);
            this.initiate_plugin('.shop-items-navigation', {
                containerID : "shop-items-wrapper",
                perPage     : this.limits[i].items,
                midRange    : 8,
                animation   : "fadeIn",
                links       : "blank",
                keyBrowse   : true,
                callback    : function(pages) {
                    log(pages.current);
                }
            });
            return false; // to break out of loop
            }
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've previously asked a question about an issue I have been experiencing with CSharpOptParse
I asked a question about interfaces previously and got some excellent responses. I'm really
Ok, so I previously asked a question asking about my options, I have looked
I asked a question about C-type sizes which I get a pretty good answer
I have previously solved a similar problem in this question , where I asked
Previously I've asked about inserting a column into a dataset . I now have
Before you say anything, I have read the previously asked questions about this issue.
I previously asked a question about how to chaining exceptions in C++, and one
This is a related to a previous question I have asked here, see the
I have previously written user interfaces using .NET and Windows Forms. I'm about to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.