11
我需要一個函數運行時的div數據頁的索引屬性更改jQuery的事件
var active = $('.swipeview-active'),
dpi = parseInt(active.attr('data-page-index')),
left = $('[data-page-index="' +prev+ '"]').children("img").eq(0),
right = $('[data-page-index="' +next+ '"]').children("img").eq(0);
$(active.attr('data-page-index')).change(function(){
right.clone(true). css({'z-index': 5}). fadeIn(2000).appendTo('#right');
left.clone(true). css({'z-index': 5}). fadeIn(2000).appendTo('#left');
});
我試圖改變()函數,但似乎只與輸入地裏幹活,
$(active.attr('data-page-index')).change(function(){
是否有另一種實現此目的的方法?謝謝。
我這個曾經有一天,http://meetselva.github.io/attrchange/相當不錯的插件。 – christoshrousis
在這裏檢查答案 http://stackoverflow.com/questions/16781778/detecting-attribute-change-of-value-of-an-attribute-i-made –