Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005
    Location
    Spain, Valencia
    Posts
    20,492
    Tokens
    3,575
    Habbo
    GoldenMerc

    Latest Awards:

    Default How to make objects moveable?

    Like on sulake.com site, But obviously not animated im wanting a object to move and be able to move by clicking and scrolling, Plus im wanting a part of the layout if clicked it closes down the tab or the browser (the X).
    +Rep for help
    Ross

  2. #2
    Join Date
    Dec 2007
    Location
    Manchester
    Posts
    2,236
    Tokens
    118
    Habbo
    hamheyelliot

    Latest Awards:

    Default

    First bit you could achieve nicely with jQuery UI- the 'draggable' function.

    HTML Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.min.js"></script>
    in your header/footer.

    HTML Code:
    <script>
    	$(function() {
    		$( "#draggable" ).draggable();
    	});
    </script>
    Replace that #draggable with the ID of whatever needs to be dragged.

    However, if you want to restrict the draggable object from leaving a certain boundary, it's:

    HTML Code:
    <script>
    	$(function() {
    		$( "#draggable" ).draggable({ containment: "#stay-within-me" });
    	});
    </script>
    If I'm just boggling you in any way, or want some more detail/options, let me know

    Some other people might have some better implementations to suggest for you but this is nice and solid.
    Last edited by hamheyelliot; 07-07-2011 at 06:45 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •