从javascript函数调用jquery插件 [英] calling jquery plugin from javascript function
本文介绍了从javascript函数调用jquery插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请告诉我们如何使用nama ="model"
在javascript函数中创建锚标记
和href ="#dialog".
喜欢
(登录)
同样在创建它时,它将调用与该plz帮助相关的jquery插件.
这是需要调用javascript函数的jquery.
plz tell how to create a anchor tag into javascript function with nama="model"
and href = "#dialog".
like
(Sign in)
also when its is created the it will call the jquery plugin related to that plz help.
here is jquery that need to call on javascript function .
$(document).ready(function() {
//select all the a tag with name equal to modal
$('a[name=modal]').click(function(e) {
//Cancel the link behavior
e.preventDefault();
//Get the A tag
var id = $(this).attr('href');
//Get the screen height and width
var maskHeight = $(document).height();
var maskWidth = $(window).width();
//Set heigth and width to mask to fill up the whole screen
$('#mask').css({ 'width': maskWidth, 'height': maskHeight });
//transition effect
$('#mask').fadeIn(1000);
$('#mask').fadeTo("slow", 0.8);
//Get the window height and width
var winH = $(window).height();
var winW = $(window).width();
//Set the popup window to center
$(id).css('top', winH / 2 - $(id).height() / 2);
$(id).css('left', winW / 2 - $(id).width() / 2);
//transition effect
$(id).fadeIn(2000);
});
//if close button is clicked
$('.window .close').click(function(e) {
//Cancel the link behavior
e.preventDefault();
$('#mask').hide();
$('.window').hide();
});
});
推荐答案
(document).ready(function(){ //选择所有名称等于模式的标签
(document).ready(function() { //select all the a tag with name equal to modal
('a [name = modal]').click(function(e){ //取消链接行为 e.preventDefault(); //获取A标签 var id =
('a[name=modal]').click(function(e) { //Cancel the link behavior e.preventDefault(); //Get the A tag var id =
(this).attr('href'); //获取屏幕的高度和宽度 var maskHeight =
(this).attr('href'); //Get the screen height and width var maskHeight =
这篇关于从javascript函数调用jquery插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文