Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

JQuery Sortable problem

Featured Replies

Here is my code:

The Sortable function doesn't seem to work at all.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Admin Control Panel</title>
<link rel="stylesheet" type="text/css" media="all" href="css/resetText.css" />
<link rel="stylesheet" type="text/css" href="css/grids-min.css"> 
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-ui-personalized-1.6rc6.min.js"></script>
<script>
$(document).ready(function() {
	$('.mylist2').hide();	
	$('#settingBox').hide();
	$('.closeArea').bind('click', toggleContent);
  });
</script>
</head>

<body>
<div id="header"></div>
<div id="doc3" class="yui-t1">
<div id="yui-main">
	<div class="yui-b rightCon">
		<div id="settingBox">

		</div>
		<p class="settingShow" onclick="java script: $('#settingBox').slideToggle('fast');">Display Settings</p>
		<div style="clear:both;"></div>
		<div id="moduleCon">
			<div id="moduleLef" class="column">
				<div class="widget">
					<div class="widget-head">Latest Updates<div class="closeArea"></div></div>
					<div class="widget-content">
						This is some sample content.
					</div>
				</div>
				<div class="widget">
				<div class="widget-head">Latest Updates<div class="closeArea"></div></div>
				<div class="widget-content">
					This is some sample content.
				</div>
			</div>
			</div>
			<div id="moduleRig" class="column">
		   		<div class="widget">
					<div class="widget-head">Latest Updates<div class="closeArea"></div></div>
					<div class="widget-content">
						This is some sample content.
					</div>
				</div>
				<div class="widget">
					<div class="widget-head">Latest Updates<div class="closeArea"></div></div>
					<div class="widget-content">
						This is some sample content.
					</div>
				</div>
			</div>
		</div>
	 </div>
	</div>
	<div class="yui-b leftCon">
		<div id="menuCon">
			<div class="menu">
				<h3 onclick="java script: $('.mylist').slideToggle('slow');"><p style="margin-top: 5px;">Settings</p></h3>
				<ul class="mylist" >
				  <li><a href="#">my sample link #1</a></li>
				  <li><a href="#">my sample link #2</a></li>
				  <li class="bottomMI"><a href="#">my sample link #3</a></li>
				</ul>
			</div>
		   <div class="menu">
				<h3 onclick="java script: $('.mylist2').slideToggle('slow');"><p style="margin-top: 5px;">Settings</p></h3>
				<ul class="mylist2" >
				  <li><a href="#">my sample link #1</a></li>
				  <li><a href="#">my sample link #2</a></li>
				  <li class="bottomMI"><a href="#">my sample link #3</a></li>
				</ul>
			</div>
		   <div class="menu">
				<h3 onclick="java script: $('.mylist3').slideToggle('slow');"><p style="margin-top: 5px;">Settings</p></h3>
				<ul class="mylist3" >
				  <li><a href="#">my sample link #1</a></li>
				  <li><a href="#">my sample link #2</a></li>
				  <li class="bottomMI"><a href="#">my sample link #3</a></li>
				</ul>
			</div>
		</div>
	</div>
</div>
</div>
<div style="clear:both;"></div>
<div id="footer">
</div>
</body>
<script type="text/javascript">
function () {
	$('.column').Sortable(
		{
			accept: 'div.widget',
			helperclass: 'sortHelper',
			handle: '.widget-head',
			fx:300,
			tolerance: 'pointer'
		}
	);

}
var toggleContent = function(e)
{
	var targetContent = $('div.widget-content', this.parentNode.parentNode);
	if (targetContent.css('display') == 'none') {
		targetContent.show();
	} else {
		targetContent.hide();
	}
	return false;
};

</script>

</html>

 

Any help would be gr8 :)

Thanks.

Not familiar with jquery but have you tried putting the scripts at the top of the page (inside the head tags) instead of at the bottom?

  • Author

Nope, still not working when I move it, And I placed the JS code there for it to load the page first, then make the modules movable ;)

  • Author
Did you try it inside the $(document).ready(function() {})

I did that, but it never worked so then I changed the Sortable to sortable, seemed to work fine now, thanks :)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.