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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:43:31+00:00 2026-05-27T16:43:31+00:00

i am trying to slide a div content to top right side. i am

  • 0

i am trying to slide a div content to top right side. i am trying but i can’t get it, here is my html code

<html><body>  
<button id="animatenow">animate now!</button>   
<div id="container">
<div>hi</div>  
<div>there</div>  
</body>
</html>

here is script

$(document).ready(function(){
$('#animatenow').click(function(){  $('#container').animate({width: "-=300px",marginTop: "-=1250px", height: "+=50px"},1500);});  });`  

my css is

 #container{width:600px;color:#fff;background:#f00;height:400px}

my jsfiddle code

  • 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-27T16:43:32+00:00Added an answer on May 27, 2026 at 4:43 pm

    Well, a somewhat overly-complex means to do this:

    $('#animatenow').click(function(){
        var that = $('#container');
        var h = that.height();
        var w = that.width();
        $('#container')
            .wrap('<div id="placeholder"></div>')
            .parent()
            .css({
                'width' : w,
                'height' : h
            })
            .find('#container')
            .css({
                'position' : 'absolute',
                'top' : 0,
                'left' : 0,
                'right' : 0,
                'bottom' : 0
            })
            .animate(
                {
                    'top' : '-' + h,
                    'left' : w,
                    'right' : '-' + w,
                    'bottom' : h
                },2000,
                function(){
                    $(this).parent().remove();
                });
    });
    

    JS Fiddle.

    The above assumes you want to avoid the sliding element’s text wrapping and re-flowing as it slides out of view. If you’re okay with re-flowing text, then it’s a lot easier and avoids adding a new wrapping element and the (hideous) call to animate().

    References:

    • animate().
    • click().
    • css().
    • find().
    • height().
    • parent().
    • remove().
    • width().
    • wrap().
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsfiddle.net/UhNHW/ I'm trying to get a color block to slide in behind existing content
I'm trying to put two divs on the right side of parent div one
I'm trying to stretch a div aligned to the right side of the page
I am trying to layout a web site but right away am having issues
I'm trying to put together a horizontal content slider using JQueryMobile. The following code
update: at bottom I am trying to get a layout working where the body
I have a problem here, i want the left hand side menu to slide
My website is setup with the content structure like this <body> <div id=header></div> <div
I'm trying to get a menu to slide in/out using jQuery UI and I
I'm trying to design a page that has two columns of content, div#left and

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.