Solved

2 Scrollable divs

Posted on 2012-03-09
9
341 Views
Last Modified: 2012-06-21
Hi Folks,

I was trying to create an app similar to USA Today app on honeycomb or CNBC App for the Ipad (just the news section) http://www.cnbc.com/id/35332013

Basically there will be 2 scrollable divs or something similar .

One Div on the left will be a scrollable menu  with some header,content,graphic. This mimics the page layout on the right where the content is in a HTML5 page.

So you would touch on the left and the related content loads on the right side of the tablet.

I am trying to find out what Framework to use. I am little bit familiar with jquery mobile and HTML5/CSS3

Thanks

RG
0
Comment
Question by:rgarimella
  • 5
  • 4
9 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37705191
jQuery mobile should work just fine.

Make the div position:absolute; overflow:scroll and ajax content into the other div onclick
and you are set
0
 

Author Comment

by:rgarimella
ID: 37705336
Can you post a sample. I am unclear on how to load jquery comtent.
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 37705542
$(document).ready(function() {
  $("#leftdiv a").on("click",function(e) {
    $("#rightDiv").load(this.href);
    return false;
  });
});

this will make all links in left div use ajax to load their hrefs into the right div and stop the links themselves from being followed

Note:  e.preventDefault(); is not supported
0
 

Author Comment

by:rgarimella
ID: 37717021
Sorry mplungjan

How do i update this HTML page, so that the Jquery function gets called. Right now the HTML page slides from the right and overwrites the 2 links

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>jQuery Mobile: Demos and Documentation</title>
	<link rel="stylesheet"  href="jquery.mobile-1.0.1.min.css" />
	<script src="jquery.js"></script>	
	<script src="jquery.mobile-1.0.1.min.js"></script>
    
<script>
$(document).ready(function() {
	alert("function called");
  $("#leftdiv a").on("click",function(e) {
    $("#rightDiv").load(this.href);
    e.preventDefault();
  });
});

</script>
</head>

<body>

<div id="leftdiv" style="position:absolute;padding-right:5%; overflow:scroll;">
<a href="te_01_01_0005.htm">Launch Index</a><BR />
<a href="te_01_01_0006.htm">Launch Page 1</a>

</div>

<div id="rightdiv" style="padding-left:30%">


</div>


</body>
</html>

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37718435
I'll have a look
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37718760
1)

$(document).ready(function() {
  $("#leftdiv a").on("click",function(e) {
    $("#rightDiv").load(this.href);
    return false; // I was sure preventDefault would work
  });
});

Open in new window


2) spelling:

<div id="rightDiv" style="padding-left:30%">
0
 

Author Comment

by:rgarimella
ID: 37720166
Here is the updated code, still does not show up in the right DIV, it just loads the page without calling the function
<code>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title>jQuery Mobile: Demos and Documentation</title>
      <link rel="stylesheet"  href="jquery.mobile-1.0.1.min.css" />
      <script src="jquery.js"></script>      
   
<script>
$(document).ready(function() {
      alert("function called");
  $("#leftdiv a").on("click",function(e) {
    $("#rightDiv").load(this.href);
    //e.preventDefault();
      return false;
  });
});

</script>
</head>

<body>

<div id="leftdiv" style="position:absolute;padding-right:5%; overflow:scroll;">
<a href="te_01_01_0005.htm">Launch Index</a><BR />
<a href="te_01_01_0006.htm">Launch Page 1</a>

</div>

<div id="rightDiv" style="padding-left:30%">


</div>


</body>
</html>
                                           
</code>
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 37720290
I tested mine here:

jQuery Mobile Test

and it worked on my iPhone
0
 

Author Comment

by:rgarimella
ID: 37721364
Thanks, worked for me too
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now