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
Related Q & A:
- How to create div that can be dragged up to reveal content?Best solution by Stack Overflow
- How to remove div completely in jQuery?Best solution by Stack Overflow
- How to check which div is visible while scrolling?Best solution by stackoverflow.com
- How to target the parent div from child div?Best solution by Stack Overflow
- How to wrap jQuery function in a div?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.