/    Sign up×
Community /Pin to ProfileBookmark

Help on js gallery

I found this very convenient:

[url]http://www.alistapart.com/articles/imagegallery[/url]

But what I really want to do is the same but only for text.

Meaning if I click on : some bananas

I want to see a div describing it in text….

Now I know it has it on the title but I want to have it so I can modified the copy….so in other words I want “some bananas” to open a div instead of opening a image and the title.

I think its here but not sure on what to change it to work:

document.getElementById(‘desc’).childNodes[0].nodeValue = whichpic.title;

Instead of title….ID? DIV? P? etc

Any ideas..

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERJun 30.2008 — More of a simplified approach, but if I understand your needs, this may work.
[code=php]
<html>
<head>
<title>DIV text</title>
<style type="text/css">
#Messages {
border:1px solid blue;
background-color:yellow;
width:200px;
height:100px;
}
</style>

<script type="text/javascript">
// from: http://www.webdeveloper.com/forum/showthread.php?t=185141

txtArray = [];
txtArray[0] = 'some bananas:::Text about <em>SOME BANANAS</em>';
txtArray[1] = 'two bottles:::Some text about the';
txtArray[1] += ' <span style="background-color:yellow">two bottles</span>';
txtArray[2] = 'some shells:::Whatever text to display about <em>some shells</em>';

function Show(msgNo) {
var str = '';
var tmp = []
tmp = txtArray[msgNo].split(':::');
document.getElementById('Messages').innerHTML = tmp[1];
}
</script>
</head>
<body>
<script type="text/javascript">
var str = '';
var tmp = [];
for (i=0; i<txtArray.length; i++) {
tmp = txtArray[i].split(':::');
str += '<a href="#" onclick="Show('+i+')">'+tmp[0]+'</a><p>';

}
document.write(str);
</script>
<div id="Messages"></div>
</body>
</html>
[/code]

Good Luck! ?
Copy linkTweet thisAlerts:
@riskmodauthorJul 02.2008 — Thanks I''ll try it.

IC
×

Success!

Help @riskmod spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...