MyBB Community Forums

Full Version: Postbit jQuery Profile details slide
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello ,
I was asking abouit the modal box help in this topic sometime ago
http://community.mybb.com/thread-143140.html
.
Now i wanted to have simple jQuery slide effect for the same ,
I tried adding the code {$post['uid']} to both the trigger as well content , but seems not working.
After many glitches i decided to ask your help.

Here is jQuery Code i am using
$('#pbop').click(function(){$('#pbopt').toggle('slow');});

<div id="pbop_{$post['uid']}" class="buttons">Options</div>
<div id="pbopt_{$post['uid']}" style="display: none;">
                        {$post['userstars']}
			{$post['groupimage']}
			{$post['user_details']} 
</div>

Help is appreciated Smile
regards
Firstly, ID should be unique per page. If you had made 2 posts on 1 topic page, you would have 2x the same id="pbop_{$post['uid']}" which is invalid. Need to use class.

Secondly, your click selector doesn't select what you want, nor the toggle selector does. You should take a look at this: http://www.w3schools.com/cssref/sel_attr_contain.asp

Here a part of similar code I wrote few weeks ago (hides user's sig in all posts with button with cookie support):
<div class="signature_{$post['uid']}">
<hr size="1" width="75%"  align="center" />
{$post['signature']}
</div>
<a class="hidesig_{$post['uid']}" href="javascript:;">Hide this user's signature</a>
<a class="showsig_{$post['uid']}" style="display: none;" href="javascript:;">Show this user's signature</a>
       $("a[class*='hidesig_']").on("click", function(){
             var hidesig_new = $(this).prop('class').split('_')[1];
             $(".hidesig_"+hidesig_new).fadeOut();
             $(".showsig_"+hidesig_new).fadeIn();
             $(".signature_"+hidesig_new).fadeOut();
             hidesig_cookie.add(hidesig_new);
        });

       $("a[class*='showsig_']").on("click", function(){
             var showsig_new = $(this).prop('class').split('_')[1];
             $(".showsig_"+showsig_new).fadeOut();
             $(".hidesig_"+showsig_new).fadeIn();
             $(".signature_"+showsig_new).fadeIn();
             hidesig_cookie.remove(showsig_new);
        });
(2013-09-29, 03:04 PM)Destroy666 Wrote: [ -> ]Firstly, ID should be unique per page. If you had made 2 posts on 1 topic page, you would have 2x the same id="pbop_{$post['uid']}" which is invalid. Need to use class.

Secondly, your click selector doesn't select what you want, nor the toggle selector does. You should take a look at this: http://www.w3schools.com/cssref/sel_attr_contain.asp

Here a part of similar code I wrote few weeks ago (hides user's sig in all posts with button with cookie support):
<div class="signature_{$post['uid']}">
<hr size="1" width="75%"  align="center" />
{$post['signature']}
</div>
<a class="hidesig_{$post['uid']}" href="javascript:;">Hide this user's signature</a>
<a class="showsig_{$post['uid']}" style="display: none;" href="javascript:;">Show this user's signature</a>
       $("a[class*='hidesig_']").on("click", function(){
             var hidesig_new = $(this).prop('class').split('_')[1];
             $(".hidesig_"+hidesig_new).fadeOut();
             $(".showsig_"+hidesig_new).fadeIn();
             $(".signature_"+hidesig_new).fadeOut();
             hidesig_cookie.add(hidesig_new);
        });

       $("a[class*='showsig_']").on("click", function(){
             var showsig_new = $(this).prop('class').split('_')[1];
             $(".showsig_"+showsig_new).fadeOut();
             $(".hidesig_"+showsig_new).fadeIn();
             $(".signature_"+showsig_new).fadeIn();
             hidesig_cookie.remove(showsig_new);
        });

Hello ,
Thanks for the help buddy , i tried using the classes but invain ,
I am trying more options , and any help is appreciated Smile
regards