Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Detect the state of Spry Effects

Posted on 2010-09-02
3
Medium Priority
?
467 Views
Last Modified: 2013-11-11
Hi Everybody

How can one detect the current state of a Spry effect (for example the slide effect)?
The problem seems to be that the state of the slide effect is lost when a page is refreshed or called newly after the slide effect has been executed. That leads to a problem when the effect is setup to allow "toggle". Example:

I slide down an initially invisible table by hitting the "hide/show" button. The table appears but contains a "next 25 items" button which refreshes the page to show the next 25 items pulled from a database. Now, if I hit the "hide/show" button again to toggle the table away (hide) again, the button, instead of sliding the table back up again, actually executes the initial effect of sliding it down (because after the page refresh it was initiated to the original state which is "up".

How can I make the spry slide effect "remember" the last state of the effect after the page is refreshed. Is there a way I can hand the state over to the next page by means of a variable, or ist there a way I can have the next page read out the last state of the slide effect?

Thanks for the help.
0
Comment
Question by:ichauch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 375 total points
ID: 33590579
You could use a server-side script (PHP or ASP) and store the state of the widget in a session variable and echo that back.  How is the "Next 25" button doing its thing?  If it is a form submit, you could capture that with Spry and not refresh the page and instead just refresh the data...that would prevent the other widgets from resetting to their onload states.
0
 

Author Comment

by:ichauch
ID: 33592982
Hi Jason. Thank you for your input. I have indeed in the meantime resolved the problem with a little piece of PHP code which simply replaces the desired Spry commands in the generated page depending on the data displayed in the table. Admittedly not the most elegant solution since it does refresh the whole page, it but works solidly and avoids adding/modifying the JS in the page. No other widgets or effects are being used so that I don't have to take them into account. But again, it could have been done more elegantly for sure.
Thanks again.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 33593254
Elegance can be overrated.  If it works, it works.
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

705 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