• Resolved bogette

    (@bogette)


    Hey

    I decided to create my own admin theme. I’ve figured out how to edit styles, but I still don’t understand how to add scripts.

    I added the necessary code to the plugin. Now I am concerned about the question: how to link my JavaScript animation and a certain element in the admin panel.

    I want to do a button animation on hover in the sidebar. I created a javascript animation, attached a javascript file to my plugin. And then the question arises: how to link the buttons in this menu with my javascript animation?

    • This topic was modified 7 years, 7 months ago by bogette.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi, bogette

    Did you use the right way to enqueue the scripts to the admin page? Please read more here https://codex.ww.wp.xz.cn/Plugin_API/Action_Reference/admin_enqueue_scripts

    <?php add_action( 'admin_enqueue_scripts', 'function_name' ); ?>

    Thread Starter bogette

    (@bogette)

    Hello, @longnguyen

    You misunderstand me a little, unfortunately. And no wonder, it’s difficult to explain, so it is not less difficult to understand.

    I get scripts. Me interested in a different question:

    To change or add styles – you use the selector. It is not difficult to find, it is enough in chrome to go to the “view code” tab of a certain element.

    What about Javascript? I created a hover button animation (javascript). I connected the file with this javascript to the plugin itself.

    But how to connect this javascript animation to the buttons in the side menu? Through Id, through selector? How?

    Hi,

    https://prnt.sc/l426in

    Each menu has an ID and I’ve tested with simple animation and it works. Maybe you not use the right selector?

    
    (function($){
    	console.log('Hello admin');
    
    	$(document).ready(function() {
    		$('#menu-media').on('mouseenter', function(){
    			$('#menu-media > a').animate({
    				left: '35px',
    			});
    		})
    	})
    })(jQuery)
    
    Thread Starter bogette

    (@bogette)

    @longnguyen

    I was stupid.. The mistake was trivial, thank you.

    I want to take this opportunity to ask for your opinion, and maybe even get advice:

    In General, I need a different layout arrangement of blocks on the “users”page.

    Look at the picture. I need a second layout.

    View post on imgur.com

    It is important to ask: is it possible to implement it without php knowledge? Using only css and javascript? I just had to ask you about it, this problem has been bothering me for days.

    How to do it, if it is really possible? And thanks again!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘How to create a javascript animation when creating an admin theme?’ is closed to new replies.