Solved

Detect the state of Spry Effects

Posted on 2010-09-02
3
461 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 125 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need help with this homework problem. 5 54
alert on input text 2 23
Hide and Unhide Table 6 24
Looking for solution to pass data to 3rd-party web platform? 4 25
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

740 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