动态Colorbox加载位置 [英] Dynamic Colorbox loading position

查看:80
本文介绍了动态Colorbox加载位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是指向颜色框示例的快速链接.

This is quick link to color box example.

我需要更改和自定义颜色框加载的位置

i need to change and customize place of color box loading

有人可以帮助我吗?

推荐答案

我将需要添加的导入代码加粗了 我不知道

I have make bold the imported code that need to add I don't know whether

$(#colorbox").css("left","200px")<就是答案.它对我不起作用.抱歉!

$("#colorbox").css("left","200px") < is the answer. it didn't work for me. SORRY!!!

但是我找到了解决方法.

However I got the solution.

您需要对jquery.colorbox.js进行一些小的更改

you need to do small changes in side the jquery.colorbox.js

var //ColorBox默认设置.
//有关详细信息,请参见 http://colorpowered.com/colorbox . 默认值= { positionTop:100,< ----添加此 positionLeft:200, < ----也添加此

var // ColorBox Default Settings.
// See http://colorpowered.com/colorbox for details. defaults = { positionTop : 100, <----add this positionLeft : 200, <----add this too

更改此代码如下(该代码位于publicMethod.position = function(速度,loadedCallback){)内

change this code looks like below(this code inside the publicMethod.position = function (speed, loadedCallback) { )

    posTop = Math.max($window.height() - settings.h - loadedHeight - interfaceHeight, 0) / 2 + $window.scrollTop() **+ settings.positionTop**,
    posLeft = Math.max($window.width() - settings.w - loadedWidth - interfaceWidth, 0) / 2 + $window.scrollLeft() **+ settings.positionLeft**;

然后,您只需指定位置即可调用颜色框

Then you can simply call colorbox by giving position

$.colorbox({html:data.content, positionTop:100 positionLeft:200

$.colorbox({html:data.content,positionTop: 100 ,positionLeft : 200

这篇关于动态Colorbox加载位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆