繁体   English   中英

更改按钮并单击div

[英]Change button and div on click

您好,我需要使用“查看360”按钮模仿此网站功能: http : //www.designrattan.co.uk/daybed/apple

我已经解决了360脚本,只是按钮无法解决?

我在这里尝试过: http : //designliving.tk/winchester-rattan-garden-round-table-set

但是您可以看到有些错误。

单击按钮时,我需要更改DIV,但是每次单击按钮时,我也需要更改按钮(从“视图360”更改为“视图图像”)。

除此之外,我还需要“照片”标签中的图像才能将div和按钮更改回“ view 360”

我想我有JavaScript,但是我不知道如何与HTML结合使用

$('.yourButton').bind('click',function(){
if (!$('.yourButton').hasClass('dragMode')) {
    $('.yourButton').addClass('dragMode');
    $('.yourButton').attr('value')="Drag [...]";
} else { // if in drag mode
    $('.yourButton').removeClass('dragMode');
    $('.yourButton').attr('value')="View 360";
}
});

$('.yourTabImages').bind('click',function(){
if ($('.yourButton').hasClass('dragMode')) {
    $('.yourButton').removeClass('dragMode');
    $('.yourButton').attr('value')="View 360";
}
});

我希望这一切都有道理!,

感谢大家!

如果您使用jquery,则可以通过类似以下内容轻松实现:

$('.yourButton').bind('click',function(){
    if (!$('.yourButton').hasClass('dragMode')) {
        $('.yourButton').addClass('dragMode');
        $('.yourButton').attr('value')="Drag [...]";
    } else { // if in drag mode
        $('.yourButton').removeClass('dragMode');
        $('.yourButton').attr('value')="View 360";
    }
});

$('.yourTabImages').bind('click',function(){
    if ($('.yourButton').hasClass('dragMode')) {
        $('.yourButton').removeClass('dragMode');
        $('.yourButton').attr('value')="View 360";
    }
});

这样,您可以在选择单击事件时选择要调用的方法时验证按钮处于哪种模式。 希望这可以帮助

不要实现自己的代码,这将需要时间。 使用任何您喜欢的插件: http : //www.jquery4u.com/plugins/jquery-360-degrees-image-display-plugins/#.T_wDU5GFp9g

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM