javascript - bpopup jQuery 不工作

标签 javascript jquery xhtml bpopup

我正在尝试在我的 xhtml 页面中使用 bpopup 示例之一,我已经尝试了所有我能想到的方法,但它不起作用。

bpopup(jQuery 插件),code example

这是我到目前为止的尝试..

HTML:

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:h="http://java.sun.com/jsf/html">

<h:head>
<title>Calendar</title>


  <link rel="stylesheet" href="http://dinbror.dk/bpopup/assets/style.min.css" media="screen" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
   <script src="http://dinbror.dk/bpopup/assets/jquery.bpopup-0.9.4.min.js"></script>
   <script src="http://dinbror.dk/bpopup/assets/jquery.easing.1.3.js"></script>
</h:head>
<h:body>
 <!-- Button that triggers the popup -->
        <button id="#my-button">POP IT UP</button>
        <!-- Element to pop up -->
        <div id="#element_to_pop_up">Content of popup</div>
</h:body>
</html>

js:

// Semicolon (;) to ensure closing of earlier scripting
// Encapsulation
// $ is assigned to jQuery
;(function($) {

 // DOM Ready
$(function() {

    // Binding a click event
    // From jQuery v.1.7.0 use .on() instead of .bind()
    $('#my-button').bind('click', function(e) {

        // Prevents the default action to be triggered. 
        e.preventDefault();

        // Triggering bPopup when click event is fired
        $('#element_to_pop_up').bPopup({
    content:'iframe', //'ajax', 'iframe' or 'image'
    contentContainer:'.content',
    loadUrl:'http://dinbror.dk/search' //Uses jQuery.load()
});


    });

});

})(jQuery);

任何帮助将不胜感激!

最佳答案

找到了!

我刚刚删除了按钮 id 和 element_to_pop_up 中的#

 <!-- Button that triggers the popup -->
        <button id="my-button">POP IT UP</button
        <!-- Element to pop up -->
        <div id="element_to_pop_up"> hello </div>

并改用这个 css 文件:

 #element_to_pop_up, .bMulti {
background-color: #FFF;
border-radius: 10px 10px 10px 10px;
box-shadow: 0 0 25px 5px #999;
color: #111;
display: none;
min-width: 450px;
min-height: 250px;
padding: 25px;
}

#element_to_pop_up .logo {
color: #2B91AF;
font: bold 325% 'Petrona',sans;
}

.button.b-close, .button.bClose {
border-radius: 7px 7px 7px 7px;
box-shadow: none;
font: bold 131% sans-serif;
padding: 0 6px 2px;
position: absolute;
right: -7px;
top: -7px;
 }

.button {
background-color: #2B91AF;
border-radius: 10px;
box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3);
color: #FFF;
cursor: pointer;
display: inline-block;
padding: 10px 20px;
text-align: center;
text-decoration: none;
}

关于javascript - bpopup jQuery 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27393489/

相关文章:

javascript - 使用 Jquery 或 Javascript 检查数组中是否存在特定 UserID 的最快方法是什么

javascript - 最好使用 JavaScript 还是 XQuery?

javascript - 在javascript中将文字对象转换为特定类的对象

javascript - Html5 - 删除插入不完整日期时输入日期的镶边错误

iphone - 为什么我的网站在我的 iPhone Safari 浏览器上看起来不一样,是我做错了什么吗?

javascript - “调试器”命令和 JSLint

javascript - 使用 JSONP 的 AJAX 跨域数据

javascript - 如何加载外部 JavaScript?

javascript - 如何将上部转换为下部并用破折号替换空格?

facebook - 有没有人有 Visual Studio 2010 for XHTML+RDFa 的验证模式?