Hi There,
I added a couple lines that should do the trick. Note that I chose to
use .attr('src') (var toggleImage...) to test for a match because just
using this.src without a regular expression would get the fully
qualified URL (at least in FF).
Not tested, but should work:
$(document).ready(
function()
{
// Toggle Single Portlet
$('a.toggle').click(function()
{
var toggleImage = $('img', this).attr('src'); // get the src
attribute of the image
$(this)
.find('img').attr('src', toggleImage == 'mini.gif' ?
'otherimage.gif' : 'mini.gif').end() // toggle the image src
attribute, then return selector to $(this)
.parent('div').next('div').toggle();
return false;
}
);
}
);
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Jan 9, 2008, at 4:13 AM, HanSolo wrote:
Hello,
im using the script from this site here http://host.sonspring.com/portlets/
But now i need a solution to change the clicksymbol (- if the content
is open and +.jpg if the content is closed/toggle).
in my HTML im only using this here:
<div class="portlet_topper" style="position:relative;">
<a href="#" class="toggle" style="margin-
left: 10px;">
<img src="mini.gif" alt="Mini"
border="0">
</a>...............
the Script is:
$(document).ready(
function()
{
// Toggle Single Portlet
$('a.toggle').click(function()
{
$(this).parent('div').next('div').toggle();
return false;
}
);
}
);
Did someone knows the way to change the JPG there?