我正在建立的这个网站上有无限滚动,同位素和名为.mb_miniplayer_play的音频播放器。我遇到的问题是当加载新页面时,先前加载的页面上的css会发生变化。让我们说第2页已加载,第1页的CSS更改。但它只有一个元素。
我尝试过各种各样的东西,但似乎没有任何东西可以使所有页面看起来和工作正常。
代码如下:
**//Audio jquery**
$(function AudioEvents(){
$(".audio").mb_miniPlayer({
width:210,
height:34,
inLine:false,
onEnd:playNext
});
var $audios = $('.audio');
function playNext(idx) {
var actualPlayer=$audios.eq(idx),
$filteredAtoms = $container.data('isotope').$filteredAtoms,
isotopeItemParent = actualPlayer.parents('.isotope-item'),
isoIndex = $filteredAtoms.index( isotopeItemParent[0] ),
nextIndex = ( isoIndex + 1 ) % $filteredAtoms.length;
$filteredAtoms.eq( nextIndex ).find('.audio').mb_miniPlayer_play();
}
**//Inifinite Scroll**
var $container = $('#container');
$container.isotope({
itemSelector : '.square'
});
$container.infinitescroll({
navSelector : '#page_nav', // selector for the paged navigation
nextSelector : '#page_nav a', // selector for the NEXT link (to page 2)
itemSelector : '.square', // selector for all items you'll retrieve
loading: {
finishedMsg: 'No more pages to load.',
img: 'http://i.imgur.com/qkKy8.gif'
}
},
// call Isotope as a callback
function( newElements ) {
var $newElements = $(newElements);
AudioEvents( $newElements );
// add hover events for new items
bindSquareEvents( $newElements );
setTimeout(function() {
$container.isotope('insert', $newElements );
}, 1000);
});
});
有没有人经历过这个。我认为我的jquery代码不正确或缺少某些东西,但我不知道是什么。
这是HTML标记......正在改变的div是.download。 ' Top'的css设置在加载的页面上需要使它看起来正确是顶部:-114而新加载的页面只需要顶部:-24看起来正确。
<div class="square techno">
<!-- DJ Picture -->
<img src="Pictures/dirtyharris.jpg" class="img1" />
<div class="boxtop">
<span class="genre">Techno</span>
</div>
<div class="box">
<a class="close" href="#close">×</a>
<!-- DJ Name -->
<h1> ThreeSixty & Dirty Harris</h1>
<!-- Song Title -->
<h2>Louka (Funkagenda Re-Edit)</h2>
<!--Song Description(179 characters with spaces)-->
<h4>I had to include this one since it literally took over control of me while driving the other morning. I was bouncing around in my seat like a little kid who desparately needs to use the bathroom. </h4>
<div class="buttons">
<!--Song file info-->
<div class="player">
<a id="m85" class="audio {skin:'#010101',showVolumeLevel:false,showTime:false,showRew:false,ogg:'MP3/Adrian Lux feat. The Good Natured - Alive (Extended Mix).ogg'}" href="MP3/Adrian Lux feat. The Good Natured - Alive (Extended Mix).mp3"></a></div>
<!--Download Link-->
<div class="download">
<a href="MP3/ThreeSixty, Funkagenda - Loudka (Funkagenda Re-Edit).mp3" title='Right Click and Save Link As'>
<img src="img/dlicon.png"/></a>
</div>
</div>
</div>
</div>
答案 0 :(得分:0)
我在你的jquery中看不到对CSS的任何更改。 CSS根据页面自行调整样式不是动态的。当然它可以被Jquery或php操纵,但我再也看不到这一点。