<div class=" text-center" style=" color: white; position: relative;">
<img src="images/image02.jpg" alt="" style="">
<a href="#group">
<div class="holder" style="position: absolute; top:0;width: 100%;height:100%;">
<div style="margin: 10px 50px; ">
<img src="images/arrow.png" alt="" style="position: absolute; top: 10px;">
<img src="images/arrow.png" alt="" style="position: absolute; bottom: 0;">
<div class="text-content" data-target = "1" style="margin:0 auto; width: 680px; position: relative; top: 15px; ">
<script type="text/javascript">
var width = $(window).width();
if ( width < 768) {
$('.text-content:eq(1)').html('<?php echo $mobile[1]?>')
}else if(width > 768 && width < 992){
$('.text-content:eq(1)').html('<?php echo $tablet[1]?>')
}else if(width > 992 && width < 1200){
$('.text-content:eq(1)').html('<?php echo $sdevice[1]?>')
}else if(width > 1200){
$('.text-content:eq(1)').html('<?php echo $ldevice[1]?>')
};
$(window).resize(function() {
width = $(window).width();
console.log(width);
if ( width < 768) {
$('.text-content:eq(1)').html('<?php echo $mobile[1]?>')
}else if(width > 768 && width < 992){
$('.text-content:eq(1)').html('<?php echo $tablet[1]?>')
}else if(width > 992 && width < 1200){
$('.text-content:eq(1)').html('<?php echo $sdevice[1]?>')
}else if(width > 1200){
$('.text-content:eq(1)').html('<?php echo $ldevice[1]?>')
};
});
</script>
</div>
</div>
</div>
</a>
</div>
"button"
答案 0 :(得分:0)
您可以使用'resize'事件。
$(document).on('resize', function(){
...
});