Hi!

I use mootools in order to show and hide a login panel in Drupal 6...
Login panel: http://web-kreation.com/index.php/tutorials/nice-login-and-signup-panel-...
Demo: http://web-kreation.com/demos/login_form_mootools_1.2/

My problem is that is breaks the javascript (admin/build/modules) and it doesn't matter if I add the javascript in page.tpl.php or in the info file, it still breaks Drupal.
So my question is... would it be possible to re-use the code from Drupal in order to show and hide the panel, or does anyone know how to fix this panel for Drupal? My knowledge about javascript is very limited...

Thank you... :)

Comments

marcvangend’s picture

jQuery is a javascript library, similar to mootools. I think it shouldn't be too hard to rewrite this script using jQuery. Look here for instance: http://nettuts.com/javascript-ajax/build-a-top-panel-with-jquery/. There are probalby more examples and tutorials out there.

NeoID’s picture

Thank you, I managed to re-write the login panel and it's now using the built in jquery.
Now it doesn't break Drupal and I only had to add a couple of js-lines.. :)

nevets’s picture

The default login block has the is block-user-0 and my test used a link like this

<a href="#" id="login-link">Login</a>

Then this is added to you themes page.tpl.php file in the head section

    <script type="text/javascript">
    	$(document).ready(function() {
    		$('#login-link').click(function() {
    			$('#block-user-0').slideToggle("fast");
    		});
    		$('#block-user-0').hide();
    	});
    </script>

This says when the link with the id login-link is clicked slide the element with id block-user-0. By using slideToggle it opens when closed and closes when open.

The last part makes sure the login block is hidden to start.

You will need to change to script to reflect the ids of the link/html you are using to open/close the login block/panel and the id of the login panel if you are opening/closing more than just the block.

andrew.eatherington@gmail.com’s picture

Followed the instructions above but I couldn't get this to work in 6.1.

Skelly1983’s picture

i used to use web-kreation.com's login drop down panel on my site before converting to drupal they have a jquery version at: http://web-kreation.com/index.php/tutorials/nice-clean-sliding-login-pan...

i would like to use this with drupal aswell but cant work out how to intergrate it (am a noob at drupal)

does anyone have any ideas how i could achieve this?

marcvangend’s picture

you can add javascript to your theme using the theme's .info file: http://drupal.org/node/171205#scripts.