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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:30:30+00:00 2026-06-18T00:30:30+00:00

I have several divs with the class itemWerk. I wish to toggle them, so

  • 0

I have several divs with the class “itemWerk”. I wish to toggle them, so that i can enlarge them and set them back to the original size and position.

I’ve come quite far as you can see over here. It’s just the positioning in my second function i can’t get to work. I’m not really sure what i should use: .position or .offSet or .data… Seen several guides that sort of explain what i’m looking for but can’t get it to work.

Here is my jQuery code:

$('.itemWerk').toggle(

function(){

    $(this)
        .animate({'z-index':'10'}, { duration: 0, queue: false })
        .animate({'left':'0.5em'}, { duration: 400, queue: false })
        .animate({'top':'0.5em'}, { duration: 400, queue: false })
        .animate({'width':'74em'}, { duration: 400, queue: false })
        .animate({'height': '53em'}, { duration: 400, queue: false })

    $("#achtergrondWerk")
        .animate({'height':'54em'},{ duration: 400, queue: false }) 
;},

function(){

    $(this)
        .animate({'left':'postion.left'}, { duration: 400, queue: false })
        .animate({'top':'position.top'}, { duration: 400, queue: false })
        .animate({'width':'10em'}, { duration: 400, queue: false })
        .animate({'height': '16em'}, { duration: 400, queue: false })

    $("#achtergrondWerk")
        .animate({'height':'38em'},{ duration: 400, queue: false }) 
});

Here is one of the divs in the HTML document:

<div class="itemWerk" id="werkEen">



</div>

And here is the CSS code for the class .itemWerk

.itemWerk {
width: 10em;
height: 16em;
background: white;
float: left;
overflow: hidden;
white-space: nowrap;
cursor: pointer;
}

and the ID #werkEen

#werkEen {
position: absolute;
top: 2em;
left: 2em;
}
  • 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-18T00:30:31+00:00Added an answer on June 18, 2026 at 12:30 am

    The animate() uses style attribute. So you can do this:

    $('.itemWerk').removeAttr('style');
    

    Yeah, I was about to say those from the comments.

    Note: The jQuery UI project extends the .animate() method by allowing some non-numeric styles such as colors to be animated. The project also includes mechanisms for specifying animations through CSS classes rather than individual attributes.

    An example with CSS Class Animation using jQuery, without using inline styles.


    If you wanna just rely on jQuery and .animate() method, you can use .data() to have the previous values stored.

    $('.itemWerk').toggle(
    
    function(){
    
        $.data(this, 'top', $(this).css('top'));
        $.data(this, 'left', $(this).css('left'));
        /* if you need to store others, yeah, go ahead **/
    
        $(this)
            .animate({'z-index':'10'}, { duration: 0, queue: false })
            .animate({'left':'0.5em'}, { duration: 400, queue: false })
            .animate({'top':'0.5em'}, { duration: 400, queue: false })
            .animate({'width':'74em'}, { duration: 400, queue: false })
            .animate({'height': '53em'}, { duration: 400, queue: false })
    
        $("#achtergrondWerk")
            .animate({'height':'54em'},{ duration: 400, queue: false }) 
    ;},
    
    function(){
    
        $(this)
            // use the $.data this way: //
            .animate({'left':$.data(this, 'left')}, { duration: 400, queue: false })
            .animate({'top':$.data(this, 'top'}, { duration: 400, queue: false })
            .animate({'width':'10em'}, { duration: 400, queue: false })
            .animate({'height': '16em'}, { duration: 400, queue: false })
    
        $("#achtergrondWerk")
            .animate({'height':'38em'},{ duration: 400, queue: false }) 
    });
    

    Working Fiddle: http://jsfiddle.net/praveenscience/K2PL3/

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

Sidebar

Related Questions

I have several divs with class image and several with class thumbnail (both can
I have several divs that share a common class. If one of these divs
I have several divs. One of them has class=active . I want all the
I have a DIV container with several inner DIVs layed out by floating them
I have a page containing several divs with the same class name for CSS
Not sure why this isn't working... I have several DIVs with an class of
I have a page I am working with that has several hidden DIVs that
I have several divs with one class on a page. <div class=main/> <div class=main/>
I have several fixed position divs with the same class at varying distances from
I have a site on which I use several divs with one class, which

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.