使用WordPress网站:http://goo.gl/3VONrG
Ajax遇到了一些问题,不确定是否与此有关。
登录弹出窗口适用于桌面网站,但不适用于移动网站。
这是菜单上按钮的菜单代码。
<li>
<a id="requestLogin" class="login-modal bg-btn-header btn-header" rel="modal-box" href="#login" title="<?php _e('Login', ET_DOMAIN);?>">
<span class="icon" data-icon="U" rel=""></span>
</a>
</li>
发现此代码链接在桌面网站上:
// View: Header
JobEngine.Views.Header = Backbone.View.extend({
el: 'header',
modal_login: {},
modal_register: {},
modal_forgot_pass: {},
templates: {
'login': '<li><a id="requestLogin" class="login-modal header-btn bg-btn-header" href="#login"><span class="icon" data-icon="U"></span></a></li>',
'auth': _.templateSettings = {
evaluate : /<#([\s\S]+?)#>/g,
interpolate : /\{\{(.+?)\}\}/g,
escape : /<%-([\s\S]+?)%>/g
},
'auth': _.template('<li><a href="{{ profile_url }}" class="bg-btn-header header-btn"><span class="icon" data-icon="U"></span></a></li>' +
'<li><a href="' + et_globals.logoutURL + '" id="requestLogout" class="bg-btn-header header-btn"><span class="icon" data-icon="Q"></span></a></li>')
},
events: {
'click a#requestLogout': 'doLogout',
'click a#requestLogin': 'doLogin',
'click a.requestlogin': 'doLogin',
'click a#requestRegister': 'doRegister'
},
initialize: function() {
if (!this.modal_login || !(this.modal_login instanceof JobEngine.Views.Modal_Login)) {
this.modal_login = new JobEngine.Views.Modal_Login();
}
if (!this.modal_register || !(this.modal_register instanceof JobEngine.Views.Modal_Register)) {
this.modal_register = new JobEngine.Views.Modal_Register();
}
if (!this.modal_forgot_pass || !(this.modal_forgot_pass instanceof JobEngine.Views.Modal_Forgot_Pass)) {
this.modal_forgot_pass = new JobEngine.Views.Modal_Forgot_Pass();
}
},
updateAuthButtons: function() {
if (!JobEngine.app.currentUser.isNew()) {
this.$('div.account ul').html(this.templates.auth(JobEngine.app.currentUser.attributes));
} else {
this.$('div.account ul').html(this.templates.login);
}
pubsub.trigger('afterUserChange', JobEngine.app.currentUser.isNew());
},
doLogout: function(e) {
e.preventDefault();
pubsub.trigger('je:request:logout');
JobEngine.app.auth.doLogout();
},
doLogin: function(e) {
e.preventDefault();
pubsub.trigger('je:request:auth');
},
doRegister: function(e) {
e.preventDefault();
pubsub.trigger('je:request:register');
}
});
如何将此代码应用于移动网站?
提前致谢。
答案 0 :(得分:0)
原来我忘记在标题中添加指向所需.js文件的链接。