How to execute ajax script on Jquery mobile?

Jquery Issue Show/Hide Div?

  • I'm trying to use a show/hide div run on a magento static block using the following code: <!-- .slidingDiv { height:300px; background-color: #99CCFF; padding:20px; margin-top:10px; border-bottom:5px solid #3399FF; } .show_hide { display:inline; } --> <script src="http://ajax.googleapis.com/ajax/lib… type="text/javascript"></script> <script type="text/javascript">// <![CDATA[ // <![CDATA $j = jQuery.noConflict(); $j(document).ready(function(){ $j(".slidingDiv").hide("slow"); $j(".show_hide").show("slow"); $j('.show_hide').click(function(){ $j(".slidingDiv").slideToggle(); }); }); // ]]></script> The hidden text is encased in a <div class="SlidingDiv"> followed by the following to call the function: <div style="margin-top: -10px; text-align: right;"><span style="text-decoration: underline;"><span style="font-size: x-small;"><strong><a class="show_hide" href="#">More</a></strong></span></span>… However, the instant it opens the div tag and shows the tag, it closes down again. It's proving rather frustrating, can anyone give a helping hand? Thanks!

  • Answer:

    I'm not sure if it has anything to with this but in the docs it sais: slideToggle(): If an element has a display value of inline, then is hidden and shown. if removing that doesn't work then try using both slide up and slide down separately example: var expanded = 1; $j('.show_hide').click(function() { if (expanded == 1) { $j(".slidingDiv").slideDown(); expanded = 0; } else { $j(".slidingDiv").slideUp(); expanded = 1; }}); Other than that, i'm not sure.

Adam H at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.