Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 951 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

Switching icons upon slide up & down

Thread title: Switching icons upon slide up & down
Reply    
    Thread tools Search this thread Display Modes  
04-10-2009, 04:01 PM
#1
hijax is offline hijax
Status: Junior Member
Join date: Apr 2009
Location:
Expertise:
Software:
 
Posts: 32
iTrader: 1 / 100%
 

hijax is on a distinguished road

  Old  Switching icons upon slide up & down

What I'm struggling with is this...

I would like to have the icon that I hit (makes the div toggle up & down) to switch images when being up and being down(hide).

would I need to append the icon images in javascript within the line ?
or am I no where near?

$(document).ready(function () {
/* $("ul.menu_body li:even").addClass("alt");*/
$('img.menu_head5').click(function () {
$('.entry2').slideToggle('slow'); <--- here?


});
});

Reply With Quote
04-10-2009, 05:55 PM
#2
BlaineSch is offline BlaineSch
BlaineSch's Avatar
Status: Member
Join date: Mar 2005
Location: Trapped in my own little world
Expertise: Web Applications
Software: Notepad++
 
Posts: 385
iTrader: 0 / 0%
 

BlaineSch is on a distinguished road

Send a message via AIM to BlaineSch Send a message via MSN to BlaineSch Send a message via Yahoo to BlaineSch Send a message via Skype™ to BlaineSch

  Old

Can you post the full source and what the problem is not just a snippet.

Reply With Quote
04-12-2009, 01:33 PM
#3
hijax is offline hijax
Status: Junior Member
Join date: Apr 2009
Location:
Expertise:
Software:
 
Posts: 32
iTrader: 1 / 100%
 

hijax is on a distinguished road

  Old

It's not that I have a problem with my code, I'm trying to find out how to do it.

I have no idea how would I approach this.

What I'm trying to do is....

have a Ican for example "-" the plus. When hit the minus icon I would like my my content to hide (slide up and hide). But then that little "-" icon would switch to a "+" icon. So when the user wants to see the content again all he has to do is hit that icon and the content slides down (visible).

Is that more accurate?

Reply With Quote
04-16-2009, 07:20 PM
#4
hijax is offline hijax
Status: Junior Member
Join date: Apr 2009
Location:
Expertise:
Software:
 
Posts: 32
iTrader: 1 / 100%
 

hijax is on a distinguished road

  Old

Nvm found what I was looking for.

Reply With Quote
07-19-2009, 06:25 PM
#5
santa is offline santa
santa's Avatar
Status: Member
Join date: Mar 2009
Location: Location: location.
Expertise: Design, HTML
Software: Espresso, Photoshop, Mail.app
 
Posts: 398
iTrader: 7 / 100%
 

santa is on a distinguished road

Send a message via ICQ to santa Send a message via AIM to santa Send a message via MSN to santa Send a message via Yahoo to santa Send a message via Skype™ to santa

  Old

Was that done in jQuery?

Reply With Quote
07-19-2009, 07:28 PM
#6
JulijanAndjelic is offline JulijanAndjelic
JulijanAndjelic's Avatar
Status: I'm new around here
Join date: Jul 2009
Location: Novi Sad, Serbia
Expertise:
Software:
 
Posts: 11
iTrader: 0 / 0%
 

JulijanAndjelic is on a distinguished road

Send a message via ICQ to JulijanAndjelic Send a message via MSN to JulijanAndjelic Send a message via Skype™ to JulijanAndjelic

  Old

Originally Posted by hijax View Post
What I'm struggling with is this...

I would like to have the icon that I hit (makes the div toggle up & down) to switch images when being up and being down(hide).

would I need to append the icon images in javascript within the line ?
or am I no where near?

$(document).ready(function () {
/* $("ul.menu_body li:even").addClass("alt");*/
$('img.menu_head5').click(function () {
$('.entry2').slideToggle('slow'); <--- here?


});
});
I know you solved the problem, just in case somebody else has the same problem...what you are looking for is the callback function.
$('.entry2').slideToggle('slow', function() {
if ($("#myImage").attr("src")=="images/minus.png") {
$("#myImage").attr("src","images/plus.png");
} else {
$("#myImage").attr("src","images/minus.png");
}
})

What we did here:
upon successful slide togle we check if the image is minus, if it is we change it to plus, othervise we change it to minus.
(I wrote the code from head without testing it but it should work, eventually I havent closed some braces...and you need, of course, to change image paths and selectors).

Best regards,
Julijan Andjelic

Reply With Quote
Reply    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed