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 8287315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:00:01+00:00 2026-06-08T12:00:01+00:00

Consider the following function . This will be called everytime the browser is resized

  • 0

Consider the following function . This will be called everytime the browser is resized and every time I want to pass the same initial value of the this.original_ul to this function doLayout() . It is computed only once inside an initialization function separately . Right now what is happening is second time when it is called , the changes to the $ul variable also is getting reflected on this.original_ul . How can I possibly prevent this ?

doLayout : function () {
    alert('doLayout');
    var size, $ul, $lis, loop, i;
    size = this.computeElesPerCol();
    $ul = this.original_ul; // I wanna  preserve this between calls
    $lis = $ul.children().filter(':gt(' + (size - 1) + ')');
    loop = Math.ceil($lis.length / size);
    i = 0;

    $ul.css('float', 'left').wrap("<div style='overflow: hidden'></div>");

    for (; i < loop; i = i + 1) {
      $ul = $("<ul />").css('float', 'left').append($lis.slice(i * size, (i * size) + 4)).insertAfter($ul);
      $ul.css("list-style","none");
    }
  }

Edit: : this is a reference to the javascript object WebFloatLayout which basically does a multi column layout depending on the available height every time the browser is resized . The initial input is a long list of <lis> in a single <ul> . Here is how it gets initialized :

     initialize:function () {
    var webFloatLayout = this;
    //call super parent initialize which will set the main dom element of component
    ec.comp.Component.prototype.initialize.call(this);
    var innerDivId = this.id + "_inner";
    innerDivId = innerDivId.replace(new RegExp(ec.config.separator, "g"), "\\" + ec.config.separator);
    $(document).ready(function() {
      webFloatLayout.original_ul = $("#" + innerDivId).find(">:first-child");
      webFloatLayout.original_ul.css("list-style","none");
      webFloatLayout.layout();
    });
  },
  • 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-08T12:00:01+00:00Added an answer on June 8, 2026 at 12:00 pm

    Try the clone method:

    $ul = this.original_ul.clone();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following base code: (function($) { $.fn.myPlugin = function(settings) { return this.each(function() {
Consider the following snippet: $(document).bind('mousemove', function(e) { $('#someDiv').css({left: e.pageX+'px', top: e.pageY+'px'}); }); This should
Consider the following function: void f(const char* str); Suppose I want to generate a
Consider the following Javascript function (1): function setData(domElement) { domElement.myDataProperty = { 'suppose': 'this',
Consider the following code: function Dog() { this.foo = function() {}; this.walk = function()
Consider the following function, which does not work in Python, but I will use
Let's consider the following scenario: a function which can generate code colors from white
Consider the following code: $(document).ready(function() { $(body).append(<div class='outer'><span class='inner'>Click me</span></div>); $(html).click(function(event) { var targetClass
Consider the following code: $(window).unload(function () { console.log('foo'); }); If I trigger the unload
Consider following string Some string with quotes and \pre-slashed\ quotes Using regex, I want

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.