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

  • Home
  • SEARCH
  • 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 3347422
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:25:11+00:00 2026-05-18T01:25:11+00:00

I am creating a function that I need to pass in values from an

  • 0

I am creating a function that I need to pass in values from an array, one of the values I need to add in is a series of values for the jquery css array

essentially I need to do the following

myArray = new Array();
myArray[0] = ""{'float':'left','-webkit-border-top-left-radius':'20px','-webkit-border-bottom-left-radius':'20px','-webkit-border-top-right-radius':'0px','-webkit-border-bottom-right-radius':'20px'}";"
function(){
$("#myDiv").click(function(){
$(this).css(myArray[0]):
});
}

That’s not the exact code as its part of a way bigger function, however the aspect I am falling down on is passing the string in the array to the .css array, I can do this if I were to only include the value in the array, however this means I need to add additional items to my array which I don’t want to do

Any help – pointers would be appreciated

Many thanks!

So for context

okay so my array is
var card2Pos = new Array();
card2Pos[0]="475px";
card2Pos[1]="80px";
card2Pos[2]="1";
card2Pos[3]="500px";
card2Pos[4]="70px";
card2Pos[5]="90px";
card2Pos[6]="510px";
card2Pos[7]="9";
card2Pos[8]="{'float':'left','-webkit-border-top-left-radius':'20px','-webkit-border-bottom-left-radius':'20px','-webkit-border-top-right-radius':'0px','-webkit-border-bottom-right-radius':'20px'}";
card2Pos[9]="475px";
card2Pos[10]="80px";
card2Pos[11]="580px";
card2Pos[12]="60px";
card2Pos[13]="8";
card2Pos[14]="right";
card2Pos[15]="450px";
card2Pos[16]="90px";
card2Pos[17]="625px";
card2Pos[18]="60px";
card2Pos[19]="7";
card2Pos[20]="right";
card2Pos[21]="425px";
card2Pos[22]="100px";
card2Pos[23]="670px";
card2Pos[24]="60px";
card2Pos[25]="6";
card2Pos[26]="right";
card2Pos[27]="400px";
card2Pos[28]="110px";
card2Pos[29]="715px";
card2Pos[30]="60px";
card2Pos[31]="5";
card2Pos[32]="right";
card2Pos[33]="375px";
card2Pos[34]="120px";
card2Pos[35]="760px";
card2Pos[36]="60px";
card2Pos[37]="4";
card2Pos[38]="right";
card2Pos[39]="350px";
card2Pos[40]="130px";
card2Pos[41]="805px";
card2Pos[42]="60px";
card2Pos[43]="3";
card2Pos[44]="right";
card2Pos[45]="325px";
card2Pos[46]="140px";
card2Pos[47]="850px";
card2Pos[48]="60px";
card2Pos[49]="2";
card2Pos[50]="right";

being passed into the following function
`
function uber(arg) {
$card1.animate({
height:arg[0],
top:arg[1]
},500).css({‘z-index’:card2Pos[2]});

    $card2.animate({
                    height:arg[3],
                    top:arg[4],
                    left:arg[5],
                    width:arg[6]
                    },500).css({'z-index':arg[7]});
    $card2Nav.css(arg[8]);
    $card3.animate({
                    height:arg[9],
                    top:arg[10],
                    left:arg[11],
                    width:arg[12]
                    },500).css({'z-index':arg[13]});
    $card3Nav.css({'float':arg[14]});
    $card4.animate({
                    height:arg[15],
                    top:arg[16],
                    left:arg[17],
                    width:arg[18]                       
                    },500).css({'z-index':arg[19]});
    $card4Nav.css({'float':arg[20]});
    $card5.animate({
                    height:arg[21],
                    top:arg[22],
                    left:arg[23],
                    width:arg[24]
                    },500).css({'z-index':arg[25]});
    $card5Nav.css({'float':arg[26]});
    $card6.animate({
                    height:arg[27],
                    top:arg[28],
                    left:arg[29],
                    width:arg[30]
                    },500).css({'z-index':arg[31]});
    $card6Nav.css({'float':arg[32]});
    $card7.animate({
                    height:arg[33],
                    top:arg[34],
                    left:arg[35],
                    width:arg[36]
                    },500).css({'z-index':arg[37]});
    $card7Nav.css({'float':arg[38]});
    $card8.animate({
                    height:arg[39],
                    top:arg[40],
                    left:arg[41],
                    width:arg[42]
                    },500).css({'z-index':arg[43]});
    $card8Nav.css({'float':arg[44]});
    $card9.animate({
                    height:arg[45],
                    top:arg[46],
                    left:arg[47],
                    width:arg[48]
                    },500).css({'z-index':arg[49]});
    $card9Nav.css({'float':arg[50]});
}
`
  • 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-05-18T01:25:12+00:00Added an answer on May 18, 2026 at 1:25 am

    You can do this, but don’t store it as a string – rather directly as an object, like this:

    var myArray = [
      {'float':'left','-webkit-border-top-left-radius':'20px','-webkit-border-bottom-left-radius':'20px','-webkit-border-top-right-radius':'0px','-webkit-border-bottom-right-radius':'20px'}
      //more objects...
    ];
    $(function(){
      $("#myDiv").click(function(){
        $(this).css(myArray[0]);
      });
    });
    

    You can try it out here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a function where I need to pass an object so that it
I am creating a PHP function that will take some values, one of which
I need to add some function that returns a value to a dom element.
I'm having trouble creating a mouseover function with an NSTableView. The idea is that
I'm creating a bookmarklet and everything was going ok. I had a function that
I've got a function creating some XmlDocument: public string CreateOutputXmlString(ICollection<Field> fields) { XmlWriterSettings settings
I'm doing this system Stacked and I am creating the search function. And in
Currently I have the function CreateLog() for creating a a log4net Log with name
I am manually creating the equivalent lambda: var function = p => p.Child.Any(c =>
I'm working on creating a call back function for an ASP.NET cache item removal

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.