我有一個jQuery腳本,從右向左滑動一個名爲.inner的div。但問題是,它會用class .inner切換所有的div。我需要做些什麼來切換.next().inner?jQuery切換下一個div
$(document).ready(function() {
// This will fire when document is ready:
$(window).resize(function() {
// This will fire each time the window is resized:
if($(window).width() <= 768) {
// if larger or equal
$(".myButton").click(function() {
// Set the effect type
var effect = 'slide';
// Set the options for the effect type chosen
var options = { direction: $().val('right') };
// Set the duration (default: 400 milliseconds)
var duration = 500;
$('.inner').toggle(effect, options, duration);
});
} else {
// if smaller
$('.element').hide();
}
}).resize(); // This will simulate a resize to trigger the initial run.
});
謝謝
編輯:
HTML:
<div class="col-xs-1 col-md-1">
<span class="glyphicon glyphicon-th-list icons-popover myButton" data-html=true data-popover="true" data-content="
<div class='actions'>
<a href='#' data-toggle='tooltip' data-placement='top' title='Something'><span class='glyphicon glyphicon-file'></span></a>
</div>">
</span>
</div>
<div class="inner" style="margin-left: 0px;">
// somethinh
</div>
<div class="close myButton"><span class='glyphicon glyphicon-remove'></div>
$(本) .next('。inner') – 2014-10-05 11:06:42
它不適用於next()。當我申請下我的腳本停止工作 – 2014-10-05 11:21:20