jquery滑块在通过ajax加载时不起作用 [英] jquery sliders not working when loading through ajax

查看:170
本文介绍了jquery滑块在通过ajax加载时不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jquery滑块插件创建一些滑块。当我启动dom时直接加载它,但是当我尝试使用它们没有被暗示的ajax innerHTML方法加载滑块到一个div时,这可以正常工作。

I am using the jquery slider plugin to create some sliders. This works fine when I load them directly when the dom is initiated however when I try to load the sliders into a div using the ajax innerHTML method they do not get intiated.

有什么事情可以做到吗?

Does anything know how I can do this?

推荐答案

你必须重新启动/绑定你的事件。

You have to initiate / bind your events again.

例如

//Ajax done and innerHTML is set
$('container').slider(); //Just an example... this will bind events.

您可以更改事件处理程序到 .live 。这可以处理动态内容。

You can change the event handlers to .live . This handles dynamic content.

这篇关于jquery滑块在通过ajax加载时不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆