Extended Overlay module head display user profile instance
Add the overlay script JS file to your custom module and use the overlay hook:
| The code is as follows: |
Copy code |
|
Function mymodule_overlay_child_initialize (){
// Add our custom JavaScript.
Drupal_add_js (drupal_get_path ('module', 'mymodule'). '/overlay-child.js ');
} Then Add the JS Avatar path to the header.
/**
* @ See hook_js_alter ().
*/
Function yourtheme_js_alter (& $ javascript ){
Global $ theme, $ user;
If (isset ($ user-> picture) & is_string ($ user-> picture )){
$ Picture = file_load ($ user-> picture );
} Www.111cn.net
Elseif (isset ($ user-> picture) & is_object ($ user-> picture )){
$ Picture = $ user-> picture;
}
If (isset ($ picture) & $ picture & isset ($ picture-> uri )){
$ Filepath = file_create_url ($ picture-> uri );
$ Javascript ['Settings'] ['data'] [] ['User _ picture '] = $ filepath;
}
} |
Add the following Javascript code to the overlay-child.js file:
| The code is as follows: |
Copy code |
|
(Function ($ ){
Drupal. behaviors. yourmodule = {
Attach: function (context ){
$ ('# Overlay: not (. your-module-adjusted)', context). each (function (){
If (Drupal. settings. user_picture ){
$ ('# Overlay-titlebar', this).css ('padding-left', 0 );
$ ('# Overlay-title-wrapper', this ). find ('h1 # overlay-title '). prepend (' ');
}
}). AddClass ('your-module-adjusted ');
$ ('. Overlay. footer'). hide ();
}
};
}) (JQuery ); |
After that, you can see the effect of the above image.
Modifies the width of the overlay layer and the hidden element instance.
The following example shows how to modify the content in the overlay layer. When a specified node type (test) is displayed in the overlay layer. This script shows you how to modify the overlay layer width to pixel PX and hide elements you don't want to see.
In your module, you also need to add the overlay-child.js script as in the above example.
Add the following Javascript code to the overlay-child.js file:
| The code is as follows: |
Copy code |
|
(Function ($ ){
// Adjust the overlay dimensions.
Drupal. behaviors. myModule = {
Attach: function (context ){
$ ('# Overlay: not (. mymodule-adjusted)', context). each (function (){
Var $ test = $ (this). find ('. node-type-test ');
If ($ test. length ){
// Adjust the overlay
Certificate (this).css ({
'Width': 'Margin px ',
'Min-width': 'min-width'
}); Www.111cn.net
$ ('. Add-or-remove-shortcuts', this). hide (); // hide "add short-cut" button
$ ('# Branding', this). hide (); // hide branding container
}
}). AddClass ('mymodule-adjusted ');
}
};
}) (JQuery ); |
If you want to modify the layout of all overlay layers, find overlay. tpl. php and modify it.