0
嗨,我使用http://brutaldesign.github.io/swipebox/在我的頁面來顯示圖像,我需要一種方法來從PHP變量傳遞給jQuery的,我正在修改 swipebox代碼使用PHP變量到jQuery的
plugin = this,
elements = [], // slides array [{href:'...', title:'...'}, ...],
elem = elem,
selector = elem.selector,
$selector = $(selector),
isTouch = document.createTouch !== undefined || ('ontouchstart' in window) || ('onmsgesturechange' in window) || navigator.msMaxTouchPoints,
supportSVG = !!(window.SVGSVGElement),
winWidth = window.innerWidth ? window.innerWidth : $(window).width(),
winHeight = window.innerHeight ? window.innerHeight : $(window).height(),
html = '<div id="swipebox-overlay">\
<div id="swipebox-slider"></div>\
<div id="swipebox-caption"><a id="swipebox-close"></a></div>\
<a id="swipebox-prev"></a>\
<a id="swipebox-next"></a>\
<div id="swipebox-action"><span class="swipebox-caption-text"></span>\
<div class="listing-details-toolbar-inner">\
<ul class="action-link-group float-l">\
<li class="action-link-item">\
<a href="#" id="shareListingBtn"\
data-artid="<?php print $artId; ?>"\
class="link-btn icon-btn ui-button-small"><span class="ic-icon share-icon"></span>Share</a>\
</li>\
<li class="action-link-item">\
<a id="addToCollection"\
data-artid="<?php print $artId;?>"\
data-show_collections="<?php print TRUE; ?>"\
data-title="<?php print $listing_single->title;?>"\
data-description="<?php print $listing_single->description; ?>"\
class="addto-Collection-btn link-btn ui-button-xsmall ui-button-primary">Collect it\
</a>\
</li>\
<li class="action-link-item">\
<?php print $smallLikeButton; ?>\
</li>\
</ul>\
</div>\
</div>';
正如你所看到的HTML是從原來的
html = '<div id="swipebox-overlay">\
<div id="swipebox-slider"></div>\
<div id="swipebox-caption"><a id="swipebox-close"></a></div>\
<a id="swipebox-prev"></a>\
<a id="swipebox-next"></a>\
<div id="swipebox-action"><span class="swipebox-caption-text"></span></div>\
</div>';
不同我的問題是我添加按鈕插件HTML,我需要使用變量,像這樣的
<?php print $artId; ?>
我該怎麼辦?