Difference between revisions of "Team:Exeter"
Line 16: | Line 16: | ||
margin-top:35px; | margin-top:35px; | ||
} | } | ||
+ | |||
+ | #element_to_pop_up { display:none; } | ||
</style> | </style> | ||
Line 24: | Line 26: | ||
</video> | </video> | ||
--> | --> | ||
+ | <!-- 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> | ||
+ | |||
+ | <script> | ||
+ | // 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(); | ||
+ | |||
+ | }); | ||
+ | |||
+ | }); | ||
+ | |||
+ | })(jQuery); | ||
+ | </script> | ||
+ | |||
<div id="infographic"> | <div id="infographic"> |
Revision as of 15:42, 18 September 2015