Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Thema gestartet von: IdanC in Juli 18, 2010, 10:20:05 VORMITTAG

Titel: TIP: Easily create a floating \ following quick reply box
Beitrag von: IdanC in Juli 18, 2010, 10:20:05 VORMITTAG
want your users to comment more easily? want to show off with a lean trick? make the quick reply box follow them!

for example: http://mila.fm/index.php?topic=2876.0
(non-english, but try clicking inside the textarea on the floating box at the bottom left, you'll get the point)
tested on ie7 ie8 ff3 & chrome

1. add this to your css:
#quickreplybox {
bottom:10px;
left:-10px;
display:block;
max-width:900px;
position:fixed;
width:350px;
z-index:1000;
}


basically, your done! this will work just fine. but if you want to have that cool expanding feature, there are just a few more changes -

2. edit Display.template.php, and find

if ($context['can_reply'] && !empty($options['display_quick_reply']))
{


3. after that add
echo '
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
  $(document).ready(function() {
 
  //have the quick reply box expand on focus
$("#quickreplybox textarea").focus(function() {
$("#quickreplybox").animate({
width: "900px"
  }, 500);
});

// be sure to know when the mouse is over the quick reply box (we will need it soon)
var mouse_is_inside = false;
    $("#quickreplybox").hover(function(){
        mouse_is_inside=true;
    }, function(){
        mouse_is_inside=false;
    });

// if the mouse is clicked somewhere OUTSIDE the reply box, fold it back
    $(document).mouseup(function(){
if(! mouse_is_inside) {
$("#quickreplybox").animate({
width: "350px"
}, 500);
};
    });

  });
</script>';

this nifty little piece of code first links to the jquery library (so if you already use it, no need for that), and then adds the code to make the effect (with enclosed comments)

of course you can and should fancy it up a little, maybe play with the hight and so on, but i'll leave that to your imagination. i'd also love to hear comments and share improvements.

---
moderators - a promotion to the tip board would be much appreciated 
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: bloc in Juli 18, 2010, 10:31:17 VORMITTAG
Nice one, quite cool to have quickreply present there. :) Could even perhaps be fully expanded at the bottom and just stay there like a frame. In any case - very interesting.
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: DoctorMalboro in Juli 18, 2010, 04:20:32 NACHMITTAGS
Cool... in wich version this work?
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: IdanC in Juli 18, 2010, 11:46:29 NACHMITTAGS
thanks Bloc!

Malboro, it's tested on rc3, but i think that with the proper adjustments it can easily be adopted to 1.11
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: Masterd in Juli 24, 2010, 10:14:07 VORMITTAG
Nice tip.
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: davyj in Juli 27, 2010, 04:15:39 VORMITTAG
great tip...thanks
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: Shole in Juli 28, 2010, 04:50:47 NACHMITTAGS
hmm... the text on the test site goes from left to right does it go from right to left in the code given?
Betvine that question this is awesome thing
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: !RFAN in September 03, 2010, 01:20:48 NACHMITTAGS
even a guest can write there???
i mean if i have not given permission to gusts then what???
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: IdanC in September 03, 2010, 01:27:09 NACHMITTAGS
with or without the inspiration of this tip, a mod was launched that achieves a similar goal, have a go at it (http://custom.simplemachines.org/mods/index.php?mod=1792).
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: !RFAN in September 03, 2010, 02:02:37 NACHMITTAGS
urs was pretty...
i ant use this mod coz i already have a bottom bar
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: IdanC in September 03, 2010, 02:05:28 NACHMITTAGS
oh, i'm flattered.

in that case, you say the problem is that the box appear even if user don't have reply permission?
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: !RFAN in September 05, 2010, 09:13:09 NACHMITTAGS
i think so.. actually i dont know what permissions u have set for ur demo...thats why i asked whether this box is shown to guests also if they dnt have permissions to reply???
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: IdanC in September 06, 2010, 02:31:38 VORMITTAG
there shouldn't be such problem because this trick uses the original replybox, which only appears when permission allow it.
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: !RFAN in September 06, 2010, 03:00:06 VORMITTAG
i'll use it then... btw.. that text direction problem has been resolved or not??
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: IdanC in September 06, 2010, 03:16:20 VORMITTAG
it's not a "problem", it's an character of the hebrew language, which is language of the demo site.

read the context man, don't just sample words...

btw, almost all old languages (such as hebrew and arabic) write from right to left, simply because it's the natural direction when you use a hammer and a chisel -

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fwww.stepbro.com%2Fhammer1.jpg&hash=8568496d63e88e67e2ef41e43baa58b61118cb1a)

while later languages were born at time when ink and feather were popular, and to avoid smearing the ink with their palm the wrote from left to right.

and that's why so many middle eastern web designers go crazy and start sharing useless historical information in unrelated forums.
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: !RFAN in September 06, 2010, 03:29:15 VORMITTAG
hey thanks for the info...  i liked this unrelated info :p
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: lucas-ruroken in September 09, 2010, 11:00:30 NACHMITTAGS
really nice tip ;)
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: Zirc in September 11, 2010, 03:24:45 NACHMITTAGS
Suppose I wanted the Quick Reply box to expand to the left instead of right because I've repositioned the box on my forums.  I would have to change the called .js script to do that wouldn't I?  Or is there something I can change in your code?
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: IdanC in September 11, 2010, 03:46:46 NACHMITTAGS
actually, i think that if you'll only change the css line "left:-10px;" to "right:-10px;", you should be fine...
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: Zirc in September 11, 2010, 03:53:34 NACHMITTAGS
Perfect!! Thanks
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: marwan in September 18, 2010, 05:41:15 VORMITTAG
Please tell me which css shall I edit? Only index.css?
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: IdanC in September 19, 2010, 04:54:36 VORMITTAG
yep, just paste it at the end, that should do the trick...
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: marwan in September 19, 2010, 04:57:47 VORMITTAG
at the very last end of the file?
Titel: Re: TIP: Easily create a floating \ following quick replay box
Beitrag von: marwan in September 19, 2010, 05:03:38 VORMITTAG
alright, got it! Working perfect!