I have been working with Django as backend and using jQuery for the front end. Now with web pages been so dynamic javascript has started to get more and more complicated and I feel the need of a better, more organized structure there. I started reading about Backone and it just feels like a backend approach to frontend (since it's an MVC framework). This would make my code more structured
我一直在使用Django作为后端,并使用jQuery作为前端。 现在,网页变得如此动态化,JavaScript开始变得越来越复杂,我觉得需要更好,更有组织的结构。 我开始阅读关于Backone的文章,它只是感觉像前端的后端方法(因为它是一个MVC框架)。 这会使我的代码更加结构化,但某些功能似乎重叠(即模型,url,...) 我也读过关于使用tastypie和django的骨干来实现RESTful环境。 这是非常酷的,因为该应用程序也可以用于手机开发
I'm looking into using Backbone.js and node.js to write a small web app. Sharing code between the client and sever is attractive. I can't figure out how clients without JS (and search engines) should interact with the site. How should form validations and rendering work with no client-side JavaScript work? Of course, I'd like to do this without code duplication. Seems to me the
我正在研究使用Backbone.js和node.js来编写一个小型的Web应用程序。 在客户端和服务器之间共享代码很有吸引力。 我无法弄清楚没有JS(和搜索引擎)的客户端应该如何与网站进行交互。 如何在没有客户端JavaScript工作的情况下形成验证和渲染工作? 当然,我想这样做没有代码重复。 在我看来,Backbone.js和其他服务器端js的意义在于,您可以在服务器和客户端上拥有相同的表单验证和模板/视图生成。 如果你的视图是用Java
I am trying to build a small app in nodejs to publish and subscribe. I am stucked in how I can publish from client side. Here is the code I have. Here is my server code (server.js) var express = require('express'), app = express(), http = require('http'), server = http.createServer(app); app.use(express.bodyParser()); app.get('/', function(req, res) { res.sendfile(__dirname + '/public/ind
我正在尝试在nodejs中构建一个小应用程序来发布和订阅。 我被困在如何从客户端发布。 这是我的代码。 这是我的服务器代码(server.js) var express = require('express'), app = express(), http = require('http'), server = http.createServer(app); app.use(express.bodyParser()); app.get('/', function(req, res) { res.sendfile(__dirname + '/public/index.html'); }); app.post('/publish/:channel/:event/'
I'm using the following code to fadein/fadeout images every second which works fine but I would like to fade the images in and out every 1/2 second. I can change the setInterval to 500 but this simply causes a bit of a mess. I clearly need to redfine fadein and fadeout. I have bootstrap loaded so I'm guessing the functions are defined within the bootstrap js but how do I respecify the
我使用下面的代码来淡出/淡出每秒图像,但是我希望每1/2秒将图像淡入淡出。 我可以将setInterval更改为500,但这只会导致一些混乱。 我显然需要重新定义淡入淡出。 我有bootstrap加载,所以我猜这些函数是在bootstrap js中定义的,但我如何重新指定它们的时间? var $els = $('div[id^=image]'), i = 0, len = $els.length; var start = 1; var end = 999999999999999; jQuery(function () { $els.slice(1)
I am trying create a slideshow using JS with the fadeIn and fadeOut methods. The issue is that the next image will fade in but the previous one will not fade out. I want to toggle the position style in the JS code so when the website loads the containers will accept the content inside and will scale appropriately. I have created a function to toggle the position style. Here is what I have
我正在尝试使用fadeIn和fadeOut方法使用JS创建幻灯片。 问题是下一张图像会淡入,但前一张图像不会淡出。 我想在JS代码中切换位置样式,因此当网站加载容器时会接受里面的内容并且可以适当缩放。 我创建了一个切换位置样式的函数。 这是我到目前为止: $(document).ready(function() { $("#slideshow > div:gt(0)").hide(); function toggle() { document.getElementById("img").style.position = "absol
I am using JS to show/hide divs via clicking on the side nav with jquery functions fadeIn() and fadeOut(). The problem I run into is as one div fades out, the next is fading in simultaneously. Also, if I click the link for the div that is already shown, it fades out and fades in again. I'm not sure if an IF statement would be the best approach to do two fixes: 1. Let shown div fully fade
我正在使用JS显示/隐藏div通过点击侧面导航与jquery函数fadeIn()和fadeOut()。 我碰到的问题是一个div淡出,另一个同时淡入。 另外,如果我点击已经显示的div的链接,它会淡出并再次淡入。 我不确定IF语句是否是进行两项修正的最佳方法: 1.让下面的div显示完全淡出,然后开始淡入淡出。 2.如果单击相同的链接,当前显示的div不会淡出/淡入。 这就是我迄今为止所做的(没有在IF声明中破坏企图): http://jsfiddl
I'm new to jQuery and I'm just wondering the easiest and most efficient way to create next/previous buttons to go through the slideshow. My code is as follows: run = setInterval("switchSlide()", 2000); $(document).ready(function() { $('#slideshow img:gt(0)').hide(); $('#slideshow').hover(function() { clearInterval(run); }, function() {
我是jQuery的新手,我只是想知道创建下一个/上一个按钮来浏览幻灯片的最简单和最有效的方法。 我的代码如下: run = setInterval("switchSlide()", 2000); $(document).ready(function() { $('#slideshow img:gt(0)').hide(); $('#slideshow').hover(function() { clearInterval(run); }, function() { run = setInterval("switchSlide()", 2000); });
I have a bunch of images that need to rotate in and out one at a time every 2 seconds with fancy JQuery fadeIn and fadeOut. I have all the images in the HTML to pre-load them and a setInterval timer that fades the current image out, then fades the next image in. Problem is that sometimes when you are clicking or scrolling during the fade in/out process, the JS gets interrupted and the current im
我有一堆需要每隔2秒钟旋转一次的图像,用花哨的JQuery fadeIn和fadeOut。 我有HTML中的所有图像预加载它们,还有一个setInterval计时器将当前图像淡出,然后淡入淡出下一个图像。问题是,有时在淡入/淡出过程中单击或滚动时, JS被打断,当前的图像不会消失,下一张图像会消失,从而给你两张图像。 我感觉它与setInterval每2秒钟不能正常运行有关,但是有没有更好的方法来完成我所需要的? 以下是一段代码: HTML <a
Context: I am astounded by the number of front end developers that hack at HTML, Javascript and CSS all day long and that ignore tools like jQuery ( or other equivalent helper frameworks ) and refuse to use them. I am not talking about JavaScript gurus, I am talking about in the trenches every day Joe production developers. I get a lot of arguments that are more like excuses or personal opinion
上下文:我很惊讶于整天侵入HTML,Javascript和CSS的前端开发人员的数量,并忽略像jQuery(或其他等效的助手框架)这样的工具并拒绝使用它们。 我不是在谈论JavaScript大师,我每天都在谈论Joe生产开发人员。 我得到了许多更像是借口或个人观点的观点,我认为这些观点没有任何技术上的优点,我想确保我不会错过任何东西。 问题:不使用jQuery的经验技术原因是什么? 我不是在寻找宗教或教条式的论点或主观意见,“像其他一
I have noticed while monitoring/attempting to answer common jQuery questions, that there are certain practices using javascript, instead of jQuery, that actually enable you to write less and do ... well the same amount. And may also yield performance benefits. A specific example $(this) vs this Inside a click event referencing the clicked objects id jQuery $(this).attr("id"); Javascrip
我注意到,在监视/试图回答常见的jQuery问题时,有一些使用javascript的实践,而不是jQuery,实际上可以让你写得更少,而且......的数量相同。 并且也可能产生性能优势。 一个具体的例子 $(this) vs this 在引用点击的对象ID的点击事件中 jQuery的 $(this).attr("id"); 使用Javascript this.id; 还有其他常见的做法吗? 在某些Javascript操作可以更容易完成的情况下,无需将jQuery加入组合。 或者这是罕见的情况