JQuery makes a fancy navigation with a shaded background and highlighted mode window
- 2020-03-30 02:38:20
- OfStack
Effect:
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201404/201404151604171.gif? 201431516511 ">
HTML link:
CSS:
One: create and invoke mode Windows
1. Create a jQuery statement that selects a trace tag with a class of schemas
2. Use the following function to store the variables in the current project as values of the rel attribute
3. Set the effect of the mode window and add the picture link to close the window
Create a shaded background
Close the mode window
Close the failed connection of the click function, this method will keep the connection and try to load another page into the browser
< img SRC = "border = 0 / / files.jb51.net/file_images/article/201404/201404151604171.gif? 201431516511 ">
HTML link:
<a href="#" rel="registerwindow" class="model"> registered </a>
CSS:
img{ border:0px;}
#registerwindow{ width:600px; height:400px; top:50px; right:100px; background:#FFF; display:none; border:5px #999 solid; position:absolute; z-index:999;}
#modelshade{width:100%; height:100%; background:#000; display:none; position:absolute; top:0px; z-index:0;}
One: create and invoke mode Windows
<div id="registerwindow">
<h1 align="center"> registered </h1><br>
<div style="width:250px; margin:0 auto;">
<form>
User name: <input type="text" name="username" size="20"><br>
The secret Code: <input type="password" name="password" size="20"><br>
<input type="submit" name="submit" value=" registered " >
</form>
</div>
</div>
1. Create a jQuery statement that selects a trace tag with a class of schemas
<script>
$('document').ready(function(){
<!-- registered model start-->
$('a.model').click(function(){
2. Use the following function to store the variables in the current project as values of the rel attribute
var modelID = $(this).attr('rel');
3. Set the effect of the mode window and add the picture link to close the window
$('#'+modelID).fadeIn(2000).prepend('<a href="#" class="close"><img src="images/close.png" class="close_button" title="close window" alt="close"></a>');
$('.close_button').css({'margin-left':'535px','margin-top':'0px'});
Create a shaded background
$('#modelshade').css('opacity','0.8').fadeIn(2000);
Close the mode window
$('a.close,#modelshade').click(function(){
var thismodelID= $('a.close').parent().attr('id');
$('#modelshade,#'+thismodelID).fadeOut(function(){
$('a.close,#modelshade').remove();
});
return false;
});
Close the failed connection of the click function, this method will keep the connection and try to load another page into the browser
return false;
});
<!-- registered model end-->
lt;/script>