Solved

Auto scroll to an anchor inside a cfdiv

Posted on 2014-02-18
10
437 Views
Last Modified: 2014-03-04
Hi,

I have a CFDIV

<cfdiv name="test">
<a name="top">TOP</a>
<div style="height:5000px;">container</div>
<a name="bottom">BOTTOM</a>
</cfdiv>

I need to scroll to the anchor #bottom when i click on a link.

Please Help

Mike
0
Comment
Question by:quarkmike
  • 5
  • 4
10 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39868333
Use : <a name="bottom" id="bottom">BOTTOM</a>

and add : #bottom to your link
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Cold_Fusion_Markup_Language/Q_28367507.html#bottom
0
 

Author Comment

by:quarkmike
ID: 39868440
Thanks Leakim but i need to post value inside cfdiv and go to the anchor (bas) without refreshing the entire page .

Example

test.cfm
<cfdiv id="mike" style="width:100px; height:200px; overflow:hidden;" ></cfdiv>

<a onClick="ColdFusion.navigate('div.cfm?testValue=1','mike');">a</a>

 -------------------

div.cfm
<cfparam name="testValue" default="0">
<div style="height:500px;background-color:red;"><cfoutput>#now()#</cfoutput></div>
<a name="bas" id="bas">#testValue#</a>
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39868608
Did you tried this?
<a onClick="ColdFusion.navigate('div.cfm?testValue=1#bas','mike');">a</a>
0
 

Author Comment

by:quarkmike
ID: 39869502
Yes.
0
 
LVL 4

Expert Comment

by:Rodrigo Munera
ID: 39870323
Mike:
<a href="#bottom" onClick="ColdFusion.navigate('div.cfm?testValue=1','mike');">Go to bottom</a>

Open in new window

0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:quarkmike
ID: 39871251
Don't work :/
0
 
LVL 82

Expert Comment

by:leakim971
ID: 39871254
Please provide a link to see that in live! Thanks :)
0
 

Author Comment

by:quarkmike
ID: 39871281
http://www.cfmike.com/test/test.cfm


test.cfm
<cfdiv id="testDiv" style="width:100px; height:200px; overflow:scroll;" ></cfdiv>

<a href="#bottom" onClick="ColdFusion.navigate('div.cfm?testValue=1','testDiv');">Go to bottom</a>

div.cfm
<cfparam name="testValue" default="0">
<div style="height:500px;background-color:red;"><cfoutput>#now()#</cfoutput></div>
<cfoutput><a name="bottom" id="bottom">#testValue#</a></cfoutput>
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 39871352
Using the callback function :
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=JavaScriptFcns_24.html

Work for me :
<a href="#bottom" onclick="ColdFusion.navigate('div.cfm?testValue=1','testDiv',function() { location.hash = '#';setTimeout(function() { location.hash = '#bottom'; },100); });return false;">Go to bottom</a>

Open in new window


This get the first link in the page : document.getElementsByTagName("a")[0]

<script>
document.getElementsByTagName("a")[0].onclick = function() {
	ColdFusion.navigate('div.cfm?testValue=1','testDiv',function() { 
		location.hash = "#";
		setTimeout(function() {
			location.hash = "#bottom";
		},100);
	});
	return false;
}
</script>

Open in new window

0
 

Author Closing Comment

by:quarkmike
ID: 39902879
Thanks guys
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Sometimes databases have MILLIONS of records and we need a way to quickly query that table to return the results me need. Sure you could use CFQUERY but it takes too long when there are millions of records. That is why SOLR was invented. Please …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 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

9 Experts available now in Live!

Get 1:1 Help Now