Home › Forums › JavaScript › [Solved] Rudimentary animation – showing more content (sliding movement)
- This topic is empty.
-
AuthorPosts
-
September 9, 2013 at 7:26 am #149497MagParticipant
Hi, I’m really beginner in the subject :( Can anyone help me out here? http://jsfiddle.net/f8zqg/179/
What I’m trying to achieve is showing and hiding div with “lorem ipsum” content.
I’ve tried some things from: http://api.jquery.com/animate/ but to no avail.
Thanks!
September 9, 2013 at 7:42 am #149501Paulie_DMemberWhat precisely are you trying to do?
You may be trying to replicate an already existing widget functionality.
September 9, 2013 at 8:04 am #149506MagParticipant- checking how much text came from cms – if detailDescription is higher than 40px then I’m showing “show more”.
- clicking “show more” should slide detailDescription down – here’s my problem with function animate or slideDown
- show more should change into “show less”
- clicking on show less should slide detailDescription up and so on :)
September 9, 2013 at 8:27 am #149509Paulie_DMemberHmmm…well there’s two different functions in there.
Sliding the div and changing the span text…not that you can’t chain them.
My JS/JQ skills are minimal but I’ll have a think.
September 9, 2013 at 8:27 am #149510MagParticipantAnd my problem is: I don’t know what I’m doing wrong but I can’t achieve smooth animation of detailDescription..
September 9, 2013 at 8:28 am #149511MagParticipantYeah, changing text is the other problem ;)
September 9, 2013 at 8:50 am #149512Paulie_DMemberAnimating to Auto is an issue so a plug-in may be required.
See the linked article and links within that.
September 9, 2013 at 8:55 am #149514Paulie_DMemberAs for swapping out the text see: http://api.jquery.com/html/
September 10, 2013 at 1:11 am #149575MagParticipantI used:
.append(“.showMoreText::after{ content:’show more’ }”)
to change text… But I don’t know if its the best js solution.. :(Paulie_D – the thing is I didn’t want to use css transitions – cause I didn’t know the height of the div. I wonder why pure jquery didin’t work..
September 10, 2013 at 1:39 am #149578Paulie_DMemberappend(“.showMoreText::after{ content:’show more’ }”)
to change text… But I don’t know if its the best js solution..No, it’s probably not.
Jquery can grab the actual text and swap it out for other text…see the link I gave.
As for the animation, pure JQuery is just a large helping hand…it’s not set up to do everything out of the box, that’s why people make plug-ins (which is just more javascript) to help it along with specific functions.
September 12, 2013 at 8:39 am #149826MagParticipantThanks for the help :)
-
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.